]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
imsm: FIX: return correct status from load_imsm_migr_rec()
authorAdam Kwolek <adam.kwolek@intel.com>
Thu, 15 Dec 2011 03:34:51 +0000 (14:34 +1100)
committerNeilBrown <neilb@suse.de>
Thu, 15 Dec 2011 03:34:51 +0000 (14:34 +1100)
load_imsm_migr_rec() should see difference between no migration record due
to no migration in progress and loading migration record error.
Additional return value (-2) was introduced to this function.

Using new status load_super_imsm_all() can correctly check loading
migration record status.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
super-intel.c

index e8e21f42cb474281f36ce610add880cfb3d4a593..3a34f5a7687d6e598c1207dfb0e0ddddde590260 100644 (file)
@@ -2120,6 +2120,7 @@ static struct imsm_dev *imsm_get_device_during_migration(
  * Returns:
  *      0 : success
  *     -1 : fail
+ *     -2 : no migration in progress
  ******************************************************************************/
 static int load_imsm_migr_rec(struct intel_super *super, struct mdinfo *info)
 {
@@ -2137,7 +2138,7 @@ static int load_imsm_migr_rec(struct intel_super *super, struct mdinfo *info)
        /* nothing to load,no migration in progress?
        */
        if (dev == NULL)
-               return 0;
+               return -2;
        map = get_imsm_map(dev, MAP_0);
 
        if (info) {
@@ -4079,13 +4080,16 @@ static int load_super_imsm_all(struct supertype *st, int fd, void **sbp,
 
        /* load migration record */
        err = load_imsm_migr_rec(super, NULL);
-       if (err) {
+       if (err == -1) {
+               /* migration is in progress,
+                * but migr_rec cannot be loaded,
+                */
                err = 4;
                goto error;
        }
 
        /* Check migration compatibility */
-       if (check_mpb_migr_compatibility(super) != 0) {
+       if ((err == 0) && (check_mpb_migr_compatibility(super) != 0)) {
                fprintf(stderr, Name ": Unsupported migration detected");
                if (devname)
                        fprintf(stderr, " on %s\n", devname);