md: don't wait faulty rdev in md_wait_for_blocked_rdev()
authorYu Kuai <yukuai3@huawei.com>
Thu, 31 Oct 2024 03:31:09 +0000 (11:31 +0800)
committerSong Liu <song@kernel.org>
Wed, 6 Nov 2024 00:08:38 +0000 (16:08 -0800)
md_wait_for_blocked_rdev() is called for write IO while rdev is
blocked, howerver, rdev can be faulty after choosing this rdev to write,
and faulty rdev should never be accessed anymore, hence there is no point
to wait for faulty rdev to be unblocked.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Tested-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Link: https://lore.kernel.org/r/20241031033114.3845582-3-yukuai1@huaweicloud.com
Signed-off-by: Song Liu <song@kernel.org>
drivers/md/md.c

index 179ee4a..b2a0e0a 100644 (file)
@@ -9762,9 +9762,7 @@ EXPORT_SYMBOL(md_reap_sync_thread);
 void md_wait_for_blocked_rdev(struct md_rdev *rdev, struct mddev *mddev)
 {
        sysfs_notify_dirent_safe(rdev->sysfs_state);
-       wait_event_timeout(rdev->blocked_wait,
-                          !test_bit(Blocked, &rdev->flags) &&
-                          !test_bit(BlockedBadBlocks, &rdev->flags),
+       wait_event_timeout(rdev->blocked_wait, !rdev_blocked(rdev),
                           msecs_to_jiffies(5000));
        rdev_dec_pending(rdev, mddev);
 }