summaryrefslogtreecommitdiffstats
path: root/drivers/md/raid5.c
diff options
context:
space:
mode:
authorJianpeng Ma <majianpeng@gmail.com>2012-10-11 05:17:59 +0200
committerNeilBrown <neilb@suse.de>2012-10-11 05:17:59 +0200
commit7f7583d420231b9d09897afd57a957011b606a5b (patch)
treeaa45d88b926bfc8e22f841b9ea83d338afa4c3ae /drivers/md/raid5.c
parentmd/raid5: make sure to_read and to_write never go negative. (diff)
downloadlinux-7f7583d420231b9d09897afd57a957011b606a5b.tar.xz
linux-7f7583d420231b9d09897afd57a957011b606a5b.zip
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.c4
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,
*/
set_bit(STRIPE_INSYNC, &sh->state);
else {
- conf->mddev->resync_mismatches += STRIPE_SECTORS;
+ atomic64_add(STRIPE_SECTORS, &conf->mddev->resync_mismatches);
if (test_bit(MD_RECOVERY_CHECK, &conf->mddev->recovery))
/* don't try to repair!! */
set_bit(STRIPE_INSYNC, &sh->state);
@@ -3125,7 +3125,7 @@ static void handle_parity_checks6(struct r5conf *conf, struct stripe_head *sh,
*/
}
} else {
- conf->mddev->resync_mismatches += STRIPE_SECTORS;
+ atomic64_add(STRIPE_SECTORS, &conf->mddev->resync_mismatches);
if (test_bit(MD_RECOVERY_CHECK, &conf->mddev->recovery))
/* don't try to repair!! */
set_bit(STRIPE_INSYNC, &sh->state);