diff options
-rw-r--r-- | drivers/md/raid5.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index c1e8607d8340..348a857ab0ff 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -416,6 +416,11 @@ static void release_stripe(struct stripe_head *sh) | |||
416 | int hash; | 416 | int hash; |
417 | bool wakeup; | 417 | bool wakeup; |
418 | 418 | ||
419 | /* Avoid release_list until the last reference. | ||
420 | */ | ||
421 | if (atomic_add_unless(&sh->count, -1, 1)) | ||
422 | return; | ||
423 | |||
419 | if (unlikely(!conf->mddev->thread) || | 424 | if (unlikely(!conf->mddev->thread) || |
420 | test_and_set_bit(STRIPE_ON_RELEASE_LIST, &sh->state)) | 425 | test_and_set_bit(STRIPE_ON_RELEASE_LIST, &sh->state)) |
421 | goto slow_path; | 426 | goto slow_path; |