Song Liu
3400aa7eda
md/raid1: fix missing bitmap update w/o WriteMostly devices
commit 46669e8616 upstream.
commit [1] causes missing bitmap updates when there isn't any WriteMostly
devices.
Detailed steps to reproduce by Norbert (which somehow didn't make to lore):
# setup md10 (raid1) with two drives (1 GByte sparse files)
dd if=/dev/zero of=disk1 bs=1024k seek=1024 count=0
dd if=/dev/zero of=disk2 bs=1024k seek=1024 count=0
losetup /dev/loop11 disk1
losetup /dev/loop12 disk2
mdadm --create /dev/md10 --level=1 --raid-devices=2 /dev/loop11 /dev/loop12
# add bitmap (aka write-intent log)
mdadm /dev/md10 --grow --bitmap=internal
echo check > /sys/block/md10/md/sync_action
root:# cat /sys/block/md10/md/mismatch_cnt
0
root:#
# remove member drive disk2 (loop12)
mdadm /dev/md10 -f loop12 ; mdadm /dev/md10 -r loop12
# modify degraded md device
dd if=/dev/urandom of=/dev/md10 bs=512 count=1
# no blocks recorded as out of sync on the remaining member disk1/loop11
root:# mdadm -X /dev/loop11 | grep Bitmap
Bitmap : 16 bits (chunks), 0 dirty (0.0%)
root:#
# re-add disk2, nothing synced because of empty bitmap
mdadm /dev/md10 --re-add /dev/loop12
# check integrity again
echo check > /sys/block/md10/md/sync_action
# disk1 and disk2 are no longer in sync, reads return differend data
root:# cat /sys/block/md10/md/mismatch_cnt
128
root:#
# clean up
mdadm -S /dev/md10
losetup -d /dev/loop11
losetup -d /dev/loop12
rm disk1 disk2
Fix this by moving the WriteMostly check to the if condition for
alloc_behind_master_bio().
[1] commit fd3b6975e9 ("md/raid1: only allocate write behind bio for WriteMostly device")
Fixes: fd3b6975e9 ("md/raid1: only allocate write behind bio for WriteMostly device")
Cc: stable@vger.kernel.org # v5.12+
Cc: Guoqing Jiang <guoqing.jiang@linux.dev>
Cc: Jens Axboe <axboe@kernel.dk>
Reported-by: Norbert Warmuth <nwarmuth@t-online.de>
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-01-11 15:35:15 +01:00
..
2021-11-18 19:17:17 +01:00
2021-12-22 09:32:36 +01:00
2019-11-05 14:53:03 -05:00
2017-06-09 09:27:32 -06:00
2020-01-07 12:07:08 -05:00
2017-03-07 11:30:16 -05:00
2021-01-24 18:17:20 -07:00
2021-03-04 14:53:54 -05:00
2017-11-02 11:10:55 +01:00
2018-04-30 15:40:40 -04:00
2017-03-07 13:28:31 -05:00
2016-12-16 00:13:41 +02:00
2021-01-24 18:15:57 -07:00
2017-03-07 13:28:31 -05:00
2017-03-07 13:28:31 -05:00
2018-10-16 14:34:59 -04:00
2014-01-16 13:44:11 -05:00
2017-03-07 13:28:31 -05:00
2021-08-10 13:34:23 -04:00
2021-04-19 13:20:31 -04:00
2020-03-27 14:42:51 -04:00
2021-10-12 13:54:10 -04:00
2021-08-10 13:32:40 -04:00
2021-08-20 16:25:07 -04:00
2021-08-10 13:34:23 -04:00
2021-08-10 13:34:23 -04:00
2021-08-31 14:55:09 -07:00
2021-08-10 13:34:23 -04:00
2015-11-04 21:19:53 -08:00
2019-05-16 15:55:48 -07:00
2021-08-10 13:34:23 -04:00
2021-09-02 12:51:41 -07:00
2021-08-20 15:59:47 -04:00
2020-08-04 15:51:28 -04:00
2021-08-31 14:55:09 -07:00
2021-06-28 16:30:13 -04:00
2021-02-26 15:49:51 -07:00
2021-08-10 13:34:23 -04:00
2021-06-15 15:42:03 -04:00
2021-08-10 13:34:23 -04:00
2021-08-10 13:34:23 -04:00
2015-04-15 12:10:20 -04:00
2009-09-04 20:40:34 +01:00
2021-08-10 13:34:23 -04:00
2021-08-10 13:34:23 -04:00
2021-08-20 16:07:36 -04:00
2008-10-10 13:36:58 +01:00
2011-10-31 19:31:18 -04:00
2020-05-15 10:29:36 -04:00
2021-08-10 13:34:23 -04:00
2021-08-10 13:34:23 -04:00
2021-08-10 13:34:23 -04:00
2021-08-10 13:34:23 -04:00
2021-08-10 13:34:23 -04:00
2021-08-10 13:34:23 -04:00
2021-08-10 13:34:23 -04:00
2018-06-12 18:28:00 -07:00
2021-10-12 13:54:10 -04:00
2019-03-05 14:48:50 -05:00
2021-08-10 13:34:23 -04:00
2021-08-10 13:34:23 -04:00
2021-08-10 13:34:23 -04:00
2020-05-20 17:09:44 -04:00
2017-11-02 11:10:55 +01:00
2021-08-10 13:34:23 -04:00
2021-08-10 13:34:23 -04:00
2018-10-11 11:36:09 -04:00
2021-09-09 11:39:57 -07:00
2019-04-25 15:38:52 -04:00
2021-06-04 12:07:22 -04:00
2019-12-05 17:05:24 -05:00
2021-08-10 13:34:23 -04:00
2019-05-30 11:26:35 -07:00
2019-05-30 11:26:35 -07:00
2021-08-10 13:34:23 -04:00
2021-04-14 14:28:29 -04:00
2021-04-14 14:28:29 -04:00
2021-10-12 13:54:09 -04:00
2021-05-25 16:14:05 -04:00
2020-08-04 15:48:13 -04:00
2020-07-13 11:47:33 -04:00
2021-08-10 13:34:23 -04:00
2020-12-04 18:04:35 -05:00
2021-06-25 15:25:23 -04:00
2021-06-04 12:07:28 -04:00
2021-06-04 12:07:24 -04:00
2021-08-10 13:34:23 -04:00
2020-06-05 14:59:53 -04:00
2021-10-12 13:54:10 -04:00
2021-06-04 12:07:37 -04:00
2021-08-16 10:50:32 -06:00
2021-08-10 13:32:40 -04:00
2020-08-23 17:36:59 -05:00
2021-06-14 22:32:07 -07:00
2018-08-01 15:49:39 -07:00
2020-12-16 13:09:32 -08:00
2018-10-18 09:36:35 -07:00
2021-06-14 22:32:07 -07:00
2021-06-14 22:32:07 -07:00
2020-05-13 12:02:23 -07:00
2021-06-14 22:32:07 -07:00
2018-05-30 15:33:32 -06:00
2021-12-14 10:57:14 +01:00
2021-08-12 10:29:36 -06:00
2021-06-14 22:32:06 -07:00
2019-09-13 13:10:05 -07:00
2019-06-15 01:37:35 -06:00
2022-01-11 15:35:15 +01:00
2021-06-14 22:32:07 -07:00
2021-03-11 07:47:48 -07:00
2019-03-12 10:15:18 -07:00
2021-03-11 07:47:48 -07:00
2021-08-28 01:46:17 +02:00
2020-09-24 16:44:44 -07:00
2021-08-30 19:01:46 -07:00
2021-06-14 22:32:07 -07:00