summaryrefslogtreecommitdiffstats
path: root/managemon.c
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 08:12:57 +0100
commit138477db4b7e810d35fd1a8fd2d1c2f05ee55da5 (patch)
treeba05cb8f2a30118fb8f8de00922a8083caac0af4 /managemon.c
parentFIX: Unfreeze array on success only (diff)
downloadmdadm-138477db4b7e810d35fd1a8fd2d1c2f05ee55da5.tar.xz
mdadm-138477db4b7e810d35fd1a8fd2d1c2f05ee55da5.zip
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>
Diffstat (limited to 'managemon.c')
-rw-r--r--managemon.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/managemon.c b/managemon.c
index 6001f6a9..1362a0e9 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