summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Kwolek <adam.kwolek@intel.com>2011-03-10 15:05:54 +0100
committerNeilBrown <neilb@suse.de>2011-03-14 18:12:57 +1100
commit138477db4b7e810d35fd1a8fd2d1c2f05ee55da5 (patch)
treeba05cb8f2a30118fb8f8de00922a8083caac0af4
parentbcc9e9edd0669a1d99b77e38dc94ae8a644f4d36 (diff)
downloadmdadm-138477db4b7e810d35fd1a8fd2d1c2f05ee55da5.tar.gz
FIX: Last checkpoint is not initialized on reshape restart
When reshape is restarted and active array in mdmon is being initialized, mdmon has to know last checkpoint, otherwise reshape will be restarted form '0' position. mdadm when reshaped array is assembled stores reshape_position in sysfs and runs mdmon. Initialize last_checkpoint in active array structure to value present in sysfs for reshaped array start. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r--managemon.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/managemon.c b/managemon.c
index 6001f6a..1362a0e 100644
--- a/managemon.c
+++ b/managemon.c
@@ -596,6 +596,7 @@ static void manage_new(struct mdstat_ent *mdstat,
char *inst;
int i;
int failed = 0;
+ char buf[40];
/* check if array is ready to be monitored */
if (!mdstat->active)
@@ -657,6 +658,20 @@ static void manage_new(struct mdstat_ent *mdstat,
dprintf("%s: inst: %d action: %d state: %d\n", __func__, atoi(inst),
new->action_fd, new->info.state_fd);
+ /* reshape_position is set by mdadm in sysfs
+ * read this information for new arrays only (empty victim)
+ */
+ if ((victim == NULL) &&
+ (sysfs_get_str(mdi, NULL, "sync_action", buf, 40) > 0) &&
+ (strncmp(buf, "reshape", 7) == 0)) {
+ if (sysfs_get_ll(mdi, NULL, "reshape_position",
+ &new->last_checkpoint) != 0)
+ new->last_checkpoint = 0;
+ dprintf("mdmon: New monitored array is under reshape.\n"
+ " Last checkpoint is: %llu\n",
+ new->last_checkpoint);
+ }
+
sysfs_free(mdi);
/* if everything checks out tell the metadata handler we want to