public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] md: wake up mdmon after setting badblocks
@ 2024-08-01 12:51 Yu Kuai
  2024-08-05  9:40 ` Mariusz Tkaczyk
  0 siblings, 1 reply; 3+ messages in thread
From: Yu Kuai @ 2024-08-01 12:51 UTC (permalink / raw)
  To: song; +Cc: linux-raid, linux-kernel, yukuai3, yukuai1, yi.zhang, yangerkun

From: Yu Kuai <yukuai3@huawei.com>

For external super_block, mdmon rely on "mddev->sysfs_state" to update
super_block. However, rdev_set_badblocks() will set sb_flags without
waking up mdmon, which might cauing IO hang due to suepr_block can't be
updated.

This problem is found by code review.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
 drivers/md/md.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 23cc77d51676..06d6ee8cd543 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -9831,10 +9831,12 @@ int rdev_set_badblocks(struct md_rdev *rdev, sector_t s, int sectors,
 		/* Make sure they get written out promptly */
 		if (test_bit(ExternalBbl, &rdev->flags))
 			sysfs_notify_dirent_safe(rdev->sysfs_unack_badblocks);
-		sysfs_notify_dirent_safe(rdev->sysfs_state);
 		set_mask_bits(&mddev->sb_flags, 0,
 			      BIT(MD_SB_CHANGE_CLEAN) | BIT(MD_SB_CHANGE_PENDING));
 		md_wakeup_thread(rdev->mddev->thread);
+
+		sysfs_notify_dirent_safe(rdev->sysfs_state);
+		sysfs_notify_dirent_safe(mddev->sysfs_state);
 		return 1;
 	} else
 		return 0;
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-05 11:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-01 12:51 [PATCH -next] md: wake up mdmon after setting badblocks Yu Kuai
2024-08-05  9:40 ` Mariusz Tkaczyk
2024-08-05 11:08   ` Yu Kuai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox