From: Hristos Nenkov <[email protected]>

rs_start_reshape() sets MD_RECOVERY_WAIT to keep the sync thread
from running before the table reload. If setup, check_reshape() or
start_reshape() fails, raid_preresume() logs the error and continues
without a reshape. There is no reshape-related table reload to wait for.

Clear MD_RECOVERY_WAIT on those error paths. Keep the bit set when
reshape setup succeeds.

Suggested-by: Yu Kuai <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Hristos Nenkov <[email protected]>
---
 drivers/md/dm-raid.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index ac019a0f5..e132951f3 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -4004,7 +4004,7 @@ static int rs_start_reshape(struct raid_set *rs)
 
        r = rs_setup_reshape(rs);
        if (r)
-               return r;
+               goto clear_recovery_wait;
 
        /*
         * Check any reshape constraints enforced by the personalility
@@ -4014,7 +4014,7 @@ static int rs_start_reshape(struct raid_set *rs)
        r = pers->check_reshape(mddev);
        if (r) {
                rs->ti->error = "pers->check_reshape() failed";
-               return r;
+               goto clear_recovery_wait;
        }
 
        /*
@@ -4025,7 +4025,7 @@ static int rs_start_reshape(struct raid_set *rs)
                r = pers->start_reshape(mddev);
                if (r) {
                        rs->ti->error = "pers->start_reshape() failed";
-                       return r;
+                       goto clear_recovery_wait;
                }
        }
 
@@ -4037,6 +4037,10 @@ static int rs_start_reshape(struct raid_set *rs)
        rs_update_sbs(rs);
 
        return 0;
+
+clear_recovery_wait:
+       clear_bit(MD_RECOVERY_WAIT, &mddev->recovery);
+       return r;
 }
 
 static int raid_preresume(struct dm_target *ti)

Reply via email to