[RFC PATCH 2/5] md: clear stale sync flags when frozen before sync starts

Zheng Qixing <[email protected]>
Newsgroups gmane.linux.raid,gmane.linux.kernel
Message-ID <[email protected]>
From: Zheng Qixing <[email protected]>

In md_check_recovery(), add clearing of all sync flags when sync is not
running. This fixes the issue where a sync operation is requested, then
'frozen' is executed before MD_RECOVERY_RUNNING is set, leaving stale
operation flags that cause subsequent operations to fail with EBUSY.

Signed-off-by: Zheng Qixing <[email protected]>
---
 drivers/md/md.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index ccaa2e6fe079..52e09a9a9288 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -10336,6 +10336,9 @@ void md_check_recovery(struct mddev *mddev)
 			queue_work(md_misc_wq, &mddev->sync_work);
 		} else {
 			clear_bit(MD_RECOVERY_RUNNING, &mddev->recovery);
+			clear_bit(MD_RECOVERY_SYNC, &mddev->recovery);
+			clear_bit(MD_RECOVERY_REQUESTED, &mddev->recovery);
+			clear_bit(MD_RECOVERY_CHECK, &mddev->recovery);
 			wake_up(&resync_wait);
 		}
 
-- 
2.39.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.