]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Super-intel: Fix first checkpoint restart
authorMateusz Kusiak <mateusz.kusiak@intel.com>
Thu, 18 Jan 2024 10:30:17 +0000 (11:30 +0100)
committerMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Tue, 20 Feb 2024 13:05:03 +0000 (14:05 +0100)
When imsm based array is stopped after reaching first checkpoint and
then assembled, first checkpoint is reported as 0.

This behaviour is valid only for initial checkpoint, if the array was
stopped while performing some action.

Last checkpoint value is not taken from metadata but always starts
with 0 and it's incremented when sync_completed in sysfs changes.

In simplification, read_and_act() is responsible for checkpoint updates
and is executed each time sysfs checkpoint update happens. For first
checkpoint it is executed twice and due to marking checkpoint before
triggering any action on the array, it is impossible to read
sync_completed from sysfs in just two iterations.

The workaround to this is not marking any checkpoint for first
sysfs checkpoint after RAID assembly, to preserve checkpoint value
stored in metadata.

Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com>
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
super-intel.c

index dbea235dd4bdfdac12f2323e702d3e634cad179a..e61f3f6ff662f945a6e5517a948060a69ffa47f3 100644 (file)
@@ -8771,6 +8771,9 @@ static int imsm_set_array_state(struct active_array *a, int consistent)
                super->updates_pending++;
        }
 
+       if (a->prev_action == idle)
+               goto skip_mark_checkpoint;
+
 mark_checkpoint:
        /* skip checkpointing for general migration,
         * it is controlled in mdadm