Skip to content

Commit af7eba0

Browse files
committed
Merge tag 'md/4.3-rc7-fixes' of git://neil.brown.name/md
Pull md bug fixes from Neil Brown: "Two more bug fixes for md. One bugfix for a list corruption in raid5 because of incorrect locking. Other for possible data corruption when a recovering device is failed, removed, and re-added. Both tagged for -stable" * tag 'md/4.3-rc7-fixes' of git://neil.brown.name/md: Revert "md: allow a partially recovered device to be hot-added to an array." md/raid5: fix locking in handle_stripe_clean_event()
2 parents d59ebbf + d01552a commit af7eba0

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

drivers/md/md.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8040,8 +8040,7 @@ static int remove_and_add_spares(struct mddev *mddev,
80408040
!test_bit(Bitmap_sync, &rdev->flags)))
80418041
continue;
80428042

8043-
if (rdev->saved_raid_disk < 0)
8044-
rdev->recovery_offset = 0;
8043+
rdev->recovery_offset = 0;
80458044
if (mddev->pers->
80468045
hot_add_disk(mddev, rdev) == 0) {
80478046
if (sysfs_link_rdev(mddev, rdev))

drivers/md/raid5.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3499,6 +3499,7 @@ static void handle_stripe_clean_event(struct r5conf *conf,
34993499
}
35003500
if (!discard_pending &&
35013501
test_bit(R5_Discard, &sh->dev[sh->pd_idx].flags)) {
3502+
int hash;
35023503
clear_bit(R5_Discard, &sh->dev[sh->pd_idx].flags);
35033504
clear_bit(R5_UPTODATE, &sh->dev[sh->pd_idx].flags);
35043505
if (sh->qd_idx >= 0) {
@@ -3512,16 +3513,17 @@ static void handle_stripe_clean_event(struct r5conf *conf,
35123513
* no updated data, so remove it from hash list and the stripe
35133514
* will be reinitialized
35143515
*/
3515-
spin_lock_irq(&conf->device_lock);
35163516
unhash:
3517+
hash = sh->hash_lock_index;
3518+
spin_lock_irq(conf->hash_locks + hash);
35173519
remove_hash(sh);
3520+
spin_unlock_irq(conf->hash_locks + hash);
35183521
if (head_sh->batch_head) {
35193522
sh = list_first_entry(&sh->batch_list,
35203523
struct stripe_head, batch_list);
35213524
if (sh != head_sh)
35223525
goto unhash;
35233526
}
3524-
spin_unlock_irq(&conf->device_lock);
35253527
sh = head_sh;
35263528

35273529
if (test_bit(STRIPE_SYNC_REQUESTED, &sh->state))

0 commit comments

Comments
 (0)