Commit 30d7a4836847bdb10b32c78a4879d4aebe0f193b
1 parent
09cd9270ea
Exists in
master
and in
6 other branches
md/raid5: ensure correct assessment of drives during degraded reshape.
While reshaping a degraded array (as when reshaping a RAID0 by first converting it to a degraded RAID4) we currently get confused about which devices are in_sync. In most cases we get it right, but in the region that is being reshaped we need to treat non-failed devices as in-sync when we have the data but haven't actually written it out yet. Reported-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
Showing 1 changed file with 10 additions and 4 deletions Side-by-side Diff
drivers/md/raid5.c
... | ... | @@ -3065,11 +3065,17 @@ |
3065 | 3065 | } |
3066 | 3066 | } else if (test_bit(In_sync, &rdev->flags)) |
3067 | 3067 | set_bit(R5_Insync, &dev->flags); |
3068 | - else { | |
3068 | + else if (sh->sector + STRIPE_SECTORS <= rdev->recovery_offset) | |
3069 | 3069 | /* in sync if before recovery_offset */ |
3070 | - if (sh->sector + STRIPE_SECTORS <= rdev->recovery_offset) | |
3071 | - set_bit(R5_Insync, &dev->flags); | |
3072 | - } | |
3070 | + set_bit(R5_Insync, &dev->flags); | |
3071 | + else if (test_bit(R5_UPTODATE, &dev->flags) && | |
3072 | + test_bit(R5_Expanded, &dev->flags)) | |
3073 | + /* If we've reshaped into here, we assume it is Insync. | |
3074 | + * We will shortly update recovery_offset to make | |
3075 | + * it official. | |
3076 | + */ | |
3077 | + set_bit(R5_Insync, &dev->flags); | |
3078 | + | |
3073 | 3079 | if (rdev && test_bit(R5_WriteError, &dev->flags)) { |
3074 | 3080 | clear_bit(R5_Insync, &dev->flags); |
3075 | 3081 | if (!test_bit(Faulty, &rdev->flags)) { |