diff options
author | Heinz Mauelshagen <heinzm@redhat.com> | 2018-12-18 19:35:41 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-12-05 11:20:37 +0300 |
commit | fe8e594cb7246815d051d78b74dc5270b7d598f3 (patch) | |
tree | 9fef8a02caa484b57ddece56a679731944e0ee9f | |
parent | 7baf8fd1ffff8e57f903956c10d8a18dc098cdbe (diff) | |
download | linux-fe8e594cb7246815d051d78b74dc5270b7d598f3.tar.xz |
dm raid: fix false -EBUSY when handling check/repair message
[ Upstream commit 74694bcbdf7e28a5ad548cdda9ac56d30be00d13 ]
Sending a check/repair message infrequently leads to -EBUSY instead of
properly identifying an active resync. This occurs because
raid_message() is testing recovery bits in a racy way.
Fix by calling decipher_sync_action() from raid_message() to properly
identify the idle state of the RAID device.
Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | drivers/md/dm-raid.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index 6c9b54288261..23de59a692c5 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 */ |