diff mbox series

dm raid: avoid busy error on scrubbing message

Message ID 94d065d1aa09b9151280a0fd34502ac335e1ac3e.1545150818.git.heinzm@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Mike Snitzer
Headers show
Series dm raid: avoid busy error on scrubbing message | expand

Commit Message

Heinz Mauelshagen Dec. 18, 2018, 4:35 p.m. UTC
Sending a check/repair message infrequently leads to -EBUSY
as oposed to identifying an active resync properly.
Cause is raid_message() testing recovery bits in a racy way.

Fix by calling decipher_sync_action() from raid_message()
to identify the idle state of the RAID device properly.

Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com>
---
 drivers/md/dm-raid.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Mike Snitzer Dec. 18, 2018, 7:50 p.m. UTC | #1
On Tue, Dec 18 2018 at 11:35am -0500,
Heinz Mauelshagen <heinzm@redhat.com> wrote:

> Sending a check/repair message infrequently leads to -EBUSY
> as oposed to identifying an active resync properly.
> Cause is raid_message() testing recovery bits in a racy way.
> 
> Fix by calling decipher_sync_action() from raid_message()
> to identify the idle state of the RAID device properly.
> 
> Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com>

Applied:
https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=dm-4.21&id=74694bcbdf7e28a5ad548cdda9ac56d30be00d13

Thanks,
Mike

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
diff mbox series

Patch

diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index e1dd1622a290..adcfe8ae10aa 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -3690,8 +3690,7 @@  static int raid_message(struct dm_target *ti, unsigned int argc, char **argv,
 			set_bit(MD_RECOVERY_INTR, &mddev->recovery);
 			md_reap_sync_thread(mddev);
 		}
-	} else if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) ||
-		   test_bit(MD_RECOVERY_NEEDED, &mddev->recovery))
+	} else if (decipher_sync_action(mddev, mddev->recovery) != st_idle)
 		return -EBUSY;
 	else if (!strcasecmp(argv[0], "resync"))
 		; /* MD_RECOVERY_NEEDED set below */