diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-09-19 11:39:32 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-09-19 11:39:32 -0400 |
commit | 12fcf66e74b16b96e57fc1ce32bdf27b3a426fd0 (patch) | |
tree | a2a51268d5195031ef7c81c8632e4a5b439e0756 | |
parent | 24420862bfb0db7c6b950b51dfecf3066766cb61 (diff) | |
parent | 184a09eb9a2fe425e49c9538f1604b05ed33cfef (diff) |
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/shli/md
Pull MD fixes from Shaohua Li:
"Two small patches to fix long-lived raid5 stripe batch bugs, one from
Dennis and the other from me"
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/shli/md:
md/raid5: preserve STRIPE_ON_UNPLUG_LIST in break_stripe_batch_list
md/raid5: fix a race condition in stripe batch
-rw-r--r-- | drivers/md/raid5.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 4188a4881148..076409455b60 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -811,6 +811,14 @@ static void stripe_add_to_batch_list(struct r5conf *conf, struct stripe_head *sh | |||
811 | spin_unlock(&head->batch_head->batch_lock); | 811 | spin_unlock(&head->batch_head->batch_lock); |
812 | goto unlock_out; | 812 | goto unlock_out; |
813 | } | 813 | } |
814 | /* | ||
815 | * We must assign batch_head of this stripe within the | ||
816 | * batch_lock, otherwise clear_batch_ready of batch head | ||
817 | * stripe could clear BATCH_READY bit of this stripe and | ||
818 | * this stripe->batch_head doesn't get assigned, which | ||
819 | * could confuse clear_batch_ready for this stripe | ||
820 | */ | ||
821 | sh->batch_head = head->batch_head; | ||
814 | 822 | ||
815 | /* | 823 | /* |
816 | * at this point, head's BATCH_READY could be cleared, but we | 824 | * at this point, head's BATCH_READY could be cleared, but we |
@@ -818,8 +826,6 @@ static void stripe_add_to_batch_list(struct r5conf *conf, struct stripe_head *sh | |||
818 | */ | 826 | */ |
819 | list_add(&sh->batch_list, &head->batch_list); | 827 | list_add(&sh->batch_list, &head->batch_list); |
820 | spin_unlock(&head->batch_head->batch_lock); | 828 | spin_unlock(&head->batch_head->batch_lock); |
821 | |||
822 | sh->batch_head = head->batch_head; | ||
823 | } else { | 829 | } else { |
824 | head->batch_head = head; | 830 | head->batch_head = head; |
825 | sh->batch_head = head->batch_head; | 831 | sh->batch_head = head->batch_head; |
@@ -4599,7 +4605,8 @@ static void break_stripe_batch_list(struct stripe_head *head_sh, | |||
4599 | 4605 | ||
4600 | set_mask_bits(&sh->state, ~(STRIPE_EXPAND_SYNC_FLAGS | | 4606 | set_mask_bits(&sh->state, ~(STRIPE_EXPAND_SYNC_FLAGS | |
4601 | (1 << STRIPE_PREREAD_ACTIVE) | | 4607 | (1 << STRIPE_PREREAD_ACTIVE) | |
4602 | (1 << STRIPE_DEGRADED)), | 4608 | (1 << STRIPE_DEGRADED) | |
4609 | (1 << STRIPE_ON_UNPLUG_LIST)), | ||
4603 | head_sh->state & (1 << STRIPE_INSYNC)); | 4610 | head_sh->state & (1 << STRIPE_INSYNC)); |
4604 | 4611 | ||
4605 | sh->check_state = head_sh->check_state; | 4612 | sh->check_state = head_sh->check_state; |