diff options
author | Artur Paszkiewicz <artur.paszkiewicz@intel.com> | 2014-06-02 15:02:59 +0200 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2014-06-03 09:09:41 +1000 |
commit | 8a3544f8959375ee167a46ff9e7fc4050127b349 (patch) | |
tree | 05988be4f5f1afa6aa050598ca60d9618427cf76 /super-intel.c | |
parent | 40b941b813e22b33ff9c70831415f5b65e0fd70b (diff) |
imsm: retry load_and_parse_mpb if we suspect mdmon has made modifications
If the checksum verification fails in mdadm and mdmon is running, retry
the load to get a consistent snapshot of the mpb.
Based on db575f3b
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'super-intel.c')
-rw-r--r-- | super-intel.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/super-intel.c b/super-intel.c index f0a7ab5c..9dd807ac 100644 --- a/super-intel.c +++ b/super-intel.c @@ -4422,6 +4422,7 @@ static int load_super_imsm(struct supertype *st, int fd, char *devname) { struct intel_super *super; int rv; + int retry; if (test_partition(fd)) /* IMSM not allowed on partitions */ @@ -4444,6 +4445,22 @@ static int load_super_imsm(struct supertype *st, int fd, char *devname) } rv = load_and_parse_mpb(fd, super, devname, 0); + /* retry the load if we might have raced against mdmon */ + if (rv == 3) { + struct mdstat_ent *mdstat = mdstat_by_component(fd2devnm(fd)); + + if (mdstat && mdmon_running(mdstat->devnm) && getpid() != mdmon_pid(mdstat->devnm)) { + for (retry = 0; retry < 3; retry++) { + usleep(3000); + rv = load_and_parse_mpb(fd, super, devname, 0); + if (rv != 3) + break; + } + } + + free_mdstat(mdstat); + } + if (rv) { if (devname) pr_err("Failed to load all information " |