]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
imsm: save checkpoint prior to exit
authorMateusz Kusiak <mateusz.kusiak@intel.com>
Mon, 2 Sep 2024 16:27:56 +0000 (12:27 -0400)
committerMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Wed, 4 Sep 2024 07:32:44 +0000 (09:32 +0200)
If reshape (eg. chunksize migration) is gracefully stopped via SIGTERM
the checkpoint is not saved and reshape cannot be resumed due to "data
being present in copy area". This is because UNIT_SRC_NORMAL isn't set
if SIGTERM occurred.

Move SIGTERM handling at the end of the loop to allow saving checkpoint
(and state) so reshapes can be properly resumed.

Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com>
super-intel.c

index 744715d5ac16df9f8dd5ec4d94f51114498c18c3..30c2939a3df660a6afa877d1286bdba2eb6b8be9 100644 (file)
@@ -12631,8 +12631,6 @@ static int imsm_manage_reshape(
                        dprintf("wait_for_reshape_imsm returned error!\n");
                        goto abort;
                }
-               if (sigterm)
-                       goto abort;
 
                if (save_checkpoint_imsm(st, sra, UNIT_SRC_NORMAL) == 1) {
                        /* ignore error == 2, this can mean end of reshape here
@@ -12641,6 +12639,9 @@ static int imsm_manage_reshape(
                        goto abort;
                }
 
+               if (sigterm)
+                       goto abort;
+
        }
 
        /* clear migr_rec on disks after successful migration */