diff options
author | Alexander Lyakas <alex.bolshoy@gmail.com> | 2012-10-11 13:50:12 +1100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2012-10-11 13:50:12 +1100 |
commit | a7854487cd7128a30a7f4f5259de9f67d5efb95f (patch) | |
tree | 8eaa70d6fec12a94c75ee023cbf4170789665d5f /drivers | |
parent | b97390aec4756373168ad2976e1f117b610513ea (diff) | |
download | linux-stable-a7854487cd7128a30a7f4f5259de9f67d5efb95f.tar.gz linux-stable-a7854487cd7128a30a7f4f5259de9f67d5efb95f.tar.bz2 linux-stable-a7854487cd7128a30a7f4f5259de9f67d5efb95f.zip |
md: When RAID5 is dirty, force reconstruct-write instead of read-modify-write.
Signed-off-by: Alex Lyakas <alex@zadarastorage.com>
Suggested-by: Yair Hershko <yair@zadarastorage.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/md/raid5.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index d11012604e28..9de8221f64ec 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -2806,12 +2806,25 @@ static void handle_stripe_dirtying(struct r5conf *conf, int disks) { int rmw = 0, rcw = 0, i; - if (conf->max_degraded == 2) { - /* RAID6 requires 'rcw' in current implementation - * Calculate the real rcw later - for now fake it + sector_t recovery_cp = conf->mddev->recovery_cp; + + /* RAID6 requires 'rcw' in current implementation. + * Otherwise, check whether resync is now happening or should start. + * If yes, then the array is dirty (after unclean shutdown or + * initial creation), so parity in some stripes might be inconsistent. + * In this case, we need to always do reconstruct-write, to ensure + * that in case of drive failure or read-error correction, we + * generate correct data from the parity. + */ + if (conf->max_degraded == 2 || + (recovery_cp < MaxSector && sh->sector >= recovery_cp)) { + /* Calculate the real rcw later - for now make it * look like rcw is cheaper */ rcw = 1; rmw = 2; + pr_debug("force RCW max_degraded=%u, recovery_cp=%llu sh->sector=%llu\n", + conf->max_degraded, (unsigned long long)recovery_cp, + (unsigned long long)sh->sector); } else for (i = disks; i--; ) { /* would I have to read this buffer for read_modify_write */ struct r5dev *dev = &sh->dev[i]; |