diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-11-08 21:33:53 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-11-08 21:33:53 -0500 |
commit | ed72a3d1b4acb8ace77a1049fbbcbc7edb035267 (patch) | |
tree | 20c228d41a9d73a8949858dc915a7a21878cc5a4 /drivers | |
parent | c8c27c955ac633c0d783ec65f65176c82809f04d (diff) | |
parent | 257a4b42af7586fab4eaec7f04e6896b86551843 (diff) |
Merge branch 'for-linus' of git://neil.brown.name/md
* 'for-linus' of git://neil.brown.name/md:
md/raid5: STRIPE_ACTIVE has lock semantics, add barriers
md/raid5: abort any pending parity operations when array fails.
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/md/raid5.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 472aedfb07cf..297e26092178 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -3110,7 +3110,7 @@ static void handle_stripe(struct stripe_head *sh) | |||
3110 | struct r5dev *pdev, *qdev; | 3110 | struct r5dev *pdev, *qdev; |
3111 | 3111 | ||
3112 | clear_bit(STRIPE_HANDLE, &sh->state); | 3112 | clear_bit(STRIPE_HANDLE, &sh->state); |
3113 | if (test_and_set_bit(STRIPE_ACTIVE, &sh->state)) { | 3113 | if (test_and_set_bit_lock(STRIPE_ACTIVE, &sh->state)) { |
3114 | /* already being handled, ensure it gets handled | 3114 | /* already being handled, ensure it gets handled |
3115 | * again when current action finishes */ | 3115 | * again when current action finishes */ |
3116 | set_bit(STRIPE_HANDLE, &sh->state); | 3116 | set_bit(STRIPE_HANDLE, &sh->state); |
@@ -3159,10 +3159,14 @@ static void handle_stripe(struct stripe_head *sh) | |||
3159 | /* check if the array has lost more than max_degraded devices and, | 3159 | /* check if the array has lost more than max_degraded devices and, |
3160 | * if so, some requests might need to be failed. | 3160 | * if so, some requests might need to be failed. |
3161 | */ | 3161 | */ |
3162 | if (s.failed > conf->max_degraded && s.to_read+s.to_write+s.written) | 3162 | if (s.failed > conf->max_degraded) { |
3163 | handle_failed_stripe(conf, sh, &s, disks, &s.return_bi); | 3163 | sh->check_state = 0; |
3164 | if (s.failed > conf->max_degraded && s.syncing) | 3164 | sh->reconstruct_state = 0; |
3165 | handle_failed_sync(conf, sh, &s); | 3165 | if (s.to_read+s.to_write+s.written) |
3166 | handle_failed_stripe(conf, sh, &s, disks, &s.return_bi); | ||
3167 | if (s.syncing) | ||
3168 | handle_failed_sync(conf, sh, &s); | ||
3169 | } | ||
3166 | 3170 | ||
3167 | /* | 3171 | /* |
3168 | * might be able to return some write requests if the parity blocks | 3172 | * might be able to return some write requests if the parity blocks |
@@ -3371,7 +3375,7 @@ finish: | |||
3371 | 3375 | ||
3372 | return_io(s.return_bi); | 3376 | return_io(s.return_bi); |
3373 | 3377 | ||
3374 | clear_bit(STRIPE_ACTIVE, &sh->state); | 3378 | clear_bit_unlock(STRIPE_ACTIVE, &sh->state); |
3375 | } | 3379 | } |
3376 | 3380 | ||
3377 | static void raid5_activate_delayed(struct r5conf *conf) | 3381 | static void raid5_activate_delayed(struct r5conf *conf) |