diff options
author | Christoph Hellwig <hch@lst.de> | 2022-07-19 11:18:20 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2022-08-02 17:22:43 -0600 |
commit | b0e706a1ba84e50eaa714486e06e1d0027411658 (patch) | |
tree | 90766c71736542591630900fe288ebc82e8dd8e5 /drivers/md | |
parent | 2652a1bd2e749ace20339996015f3cf3fbfb8672 (diff) | |
download | linux-stable-b0e706a1ba84e50eaa714486e06e1d0027411658.tar.gz linux-stable-b0e706a1ba84e50eaa714486e06e1d0027411658.tar.bz2 linux-stable-b0e706a1ba84e50eaa714486e06e1d0027411658.zip |
md: stop using for_each_mddev in md_do_sync
Just do a plain list_for_each that only grabs a mddev reference in
the case where the thread sleeps and restarts the list iteration.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/md.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 3dc398571239..f7d5865880f2 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -8723,7 +8723,6 @@ void md_do_sync(struct md_thread *thread) unsigned long update_time; sector_t mark_cnt[SYNC_MARKS]; int last_mark,m; - struct list_head *tmp; sector_t last_check; int skipped = 0; struct md_rdev *rdev; @@ -8787,7 +8786,8 @@ void md_do_sync(struct md_thread *thread) try_again: if (test_bit(MD_RECOVERY_INTR, &mddev->recovery)) goto skip; - for_each_mddev(mddev2, tmp) { + spin_lock(&all_mddevs_lock); + list_for_each_entry(mddev2, &all_mddevs, all_mddevs) { if (mddev2 == mddev) continue; if (!mddev->parallel_resync @@ -8819,7 +8819,8 @@ void md_do_sync(struct md_thread *thread) desc, mdname(mddev), mdname(mddev2)); } - mddev_put(mddev2); + spin_unlock(&all_mddevs_lock); + if (signal_pending(current)) flush_signals(current); schedule(); @@ -8829,6 +8830,7 @@ void md_do_sync(struct md_thread *thread) finish_wait(&resync_wait, &wq); } } + spin_unlock(&all_mddevs_lock); } while (mddev->curr_resync < MD_RESYNC_DELAYED); j = 0; |