diff options
author | Jianpeng Ma <majianpeng@gmail.com> | 2012-10-10 23:17:59 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2012-10-10 23:17:59 -0400 |
commit | 7f7583d420231b9d09897afd57a957011b606a5b (patch) | |
tree | aa45d88b926bfc8e22f841b9ea83d338afa4c3ae /drivers/md/raid5.c | |
parent | 1ed850f356a0a422013846b5291acff08815008b (diff) |
Subject: [PATCH] md:change resync_mismatches to atomic64_t to avoid races
Now that multiple threads can handle stripes, it is safer to
use an atomic64_t for resync_mismatches, to avoid update races.
Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r-- | drivers/md/raid5.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index ab613efbbead..4cc6b0e398bc 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -2973,7 +2973,7 @@ static void handle_parity_checks5(struct r5conf *conf, struct stripe_head *sh, | |||
2973 | */ | 2973 | */ |
2974 | set_bit(STRIPE_INSYNC, &sh->state); | 2974 | set_bit(STRIPE_INSYNC, &sh->state); |
2975 | else { | 2975 | else { |
2976 | conf->mddev->resync_mismatches += STRIPE_SECTORS; | 2976 | atomic64_add(STRIPE_SECTORS, &conf->mddev->resync_mismatches); |
2977 | if (test_bit(MD_RECOVERY_CHECK, &conf->mddev->recovery)) | 2977 | if (test_bit(MD_RECOVERY_CHECK, &conf->mddev->recovery)) |
2978 | /* don't try to repair!! */ | 2978 | /* don't try to repair!! */ |
2979 | set_bit(STRIPE_INSYNC, &sh->state); | 2979 | set_bit(STRIPE_INSYNC, &sh->state); |
@@ -3125,7 +3125,7 @@ static void handle_parity_checks6(struct r5conf *conf, struct stripe_head *sh, | |||
3125 | */ | 3125 | */ |
3126 | } | 3126 | } |
3127 | } else { | 3127 | } else { |
3128 | conf->mddev->resync_mismatches += STRIPE_SECTORS; | 3128 | atomic64_add(STRIPE_SECTORS, &conf->mddev->resync_mismatches); |
3129 | if (test_bit(MD_RECOVERY_CHECK, &conf->mddev->recovery)) | 3129 | if (test_bit(MD_RECOVERY_CHECK, &conf->mddev->recovery)) |
3130 | /* don't try to repair!! */ | 3130 | /* don't try to repair!! */ |
3131 | set_bit(STRIPE_INSYNC, &sh->state); | 3131 | set_bit(STRIPE_INSYNC, &sh->state); |