md/bitmap: don't read page from device with Bitmap_sync
PATCH v2 1/1 md/bitmap: don't read page from device with Bitmap_sync
The device owns Bitmap_sync flag needs recovery to become in sync, and read page from this type device could get stale status.
Also add comments for Bitmap_sync bit per the suggestion from Shaohua and Neil.
Previous disscussion can be found here:
https://marc.info/?t=149760428900004&r=1&w=2
Signed-off-by Guoqing Jiang <[email protected]>
--- drivers/md/bitmap.c | 3 ++- drivers/md/md.h | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/md/bitmap.c +2 -1
@@ -156,7 +156,8 @@ static int read_sb_page(struct mddev *mddev, loff_t offset,rdev_for_each (rdev, mddev) {if (!test_bit (In_sync, &rdev->flags) - ||test_bit (Faulty, &rdev->flags)) + ||test_bit (Faulty, &rdev->flags) + ||test_bit (Bitmap_sync, &rdev->flags))continue ; target = offset + index * (PAGE_SIZE /512 );
drivers/md/md.h +3 -1
@@ -134,7 +134,9 @@ enum flag_bits { Faulty,/* device is known to have a fault */ In_sync,/* device is in_sync with rest of array */ Bitmap_sync,/* ..actually, not quite In_sync. Need a -* bitmap-based recovery to get fully in sync +* bitmap-based recovery to get fully in sync. +* The bit is only meaningful before device +* has been passed to pers->hot_add_disk. */ WriteMostly,/* Avoid reading if at all possible */ AutoDetected, /* added by auto-detect */
Signature · 1 line
2.10.0
Shaohua Li
AppliedQuoted 11 lines · Guoqing Jiang
The device owns
Bitmap_syncflag needs recovery to become in sync, and read page from this type device could get stale status.Also add comments for
Bitmap_syncbit per the suggestion from Shaohua and Neil.Previous disscussion can be found here:
https://marc.info/?t=149760428900004&r=1&w=2Signed-off-by Guoqing Jiang <[email protected]>
Applied!
Quoted 37 lines
--- drivers/md/bitmap.c | 3 ++- drivers/md/md.h | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-)drivers/md/bitmap.c +2
-1@@ -156,7 +156,8 @@ static int read_sb_page(struct mddev *mddev, loff_t offset,rdev_for_each (rdev, mddev) {if (!test_bit (In_sync, &rdev->flags) - ||test_bit (Faulty, &rdev->flags)) + ||test_bit (Faulty, &rdev->flags) + ||test_bit (Bitmap_sync, &rdev->flags))continue ; target = offset + index * (PAGE_SIZE /512 );drivers/md/md.h +3
-1@@ -134,7 +134,9 @@ enum flag_bits { Faulty,/* device is known to have a fault */ In_sync,/* device is in_sync with rest of array */ Bitmap_sync,/* ..actually, not quite In_sync. Need a -* bitmap-based recovery to get fully in sync +* bitmap-based recovery to get fully in sync. +* The bit is only meaningful before device +* has been passed to pers->hot_add_disk. */ WriteMostly,/* Avoid reading if at all possible */ AutoDetected, /* added by auto-detect */Signature · 1 line
2.10.0