Linux RAID subsystem development
 help / color / mirror / Atom feed
* [PATCH] md-cluster: check pers->resize() return value in update_size()
@ 2026-08-27  2:52 ghuicao
  2026-08-27  3:07 ` sashiko-bot
  2026-08-27  6:11 ` [PATCH v2 1/3] md-cluster: fix error handling and superblock update in update_size revert ghuicao
  0 siblings, 2 replies; 14+ messages in thread
From: ghuicao @ 2026-08-27  2:52 UTC (permalink / raw)
  To: Song Liu; +Cc: Yu Kuai, Li Nan, Xiao Ni, linux-raid, linux-kernel, Cao Guanghui

From: Cao Guanghui <caoguanghui@kylinos.cn>

In update_size(), when cluster_check_sync_size() detects that not all
nodes have updated their sync_size, the initiator reverts the array
size via pers->resize().  However, the return value of resize() is
immediately overwritten by __sendmsg(), so a resize failure is
silently lost.

If the revert resize fails, the array remains at the new (larger)
size while other nodes have not confirmed the change, leaving the
cluster in an inconsistent state with no error logged.

Check the resize() return value and log an error before sending the
METADATA_UPDATED message, so that a resize failure is visible to the
user.

Signed-off-by: Cao Guanghui <caoguanghui@kylinos.cn>
---
 drivers/md/md-cluster.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
--- a/drivers/md/md-cluster.c
+++ b/drivers/md/md-cluster.c
@@ -1349,7 +1349,10 @@ static void update_size(struct mddev *mddev, sector_t old_dev_sectors)
 	} else {
 		/* revert to previous sectors */
 		ret = mddev->pers->resize(mddev, old_dev_sectors);
+		if (ret)
+			pr_err("%s:%d: failed to revert array size\n",
+			       __func__, __LINE__);
 		ret = __sendmsg(cinfo, &cmsg);
 		if (ret)
 			pr_err("%s:%d: failed to send METADATA_UPDATED msg\n",
 			       __func__, __LINE__);
-- 
2.34.1


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

end of thread, other threads:[~2026-08-27  9:05 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-27  2:52 [PATCH] md-cluster: check pers->resize() return value in update_size() ghuicao
2026-08-27  3:07 ` sashiko-bot
2026-08-27  6:11 ` [PATCH v2 1/3] md-cluster: fix error handling and superblock update in update_size revert ghuicao
2026-08-27  6:11   ` [PATCH v2 2/3] md-cluster: propagate update_size() errors to callers ghuicao
2026-08-27  6:23     ` sashiko-bot
2026-08-27  6:12   ` [PATCH v2 3/3] md-cluster: fix ack_lockres leak in __sendmsg error path ghuicao
2026-08-27  6:24     ` sashiko-bot
2026-08-27  6:24   ` [PATCH v2 1/3] md-cluster: fix error handling and superblock update in update_size revert sashiko-bot
2026-08-27  8:44   ` [PATCH v3 1/3] md-cluster: fix lock_comm leak and __sendmsg error path ghuicao
2026-08-27  8:44     ` [PATCH v3 2/3] md-cluster: fix error handling and superblock consistency in update_size ghuicao
2026-08-27  8:58       ` sashiko-bot
2026-08-27  8:44     ` [PATCH v3 3/3] md-cluster: revert local resize and propagate cluster errors ghuicao
2026-08-27  9:04       ` sashiko-bot
2026-08-27  8:58     ` [PATCH v3 1/3] md-cluster: fix lock_comm leak and __sendmsg error path sashiko-bot

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