[PATCH 03/21] imsm: FIX: imsm_check_reshape_conditions change ret_val

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Put information to return variable (ret_val) in more clear way.
manage_reshape will always unfreeze container
and this will not base on return value as it has to be always unfrozen,
on success and on error.

Signed-off-by: Adam Kwolek <adam.kwolek@xxxxxxxxx>
---

 mdadm/mdadm/super-intel.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/mdadm/mdadm/super-intel.c b/mdadm/mdadm/super-intel.c
index f628c2c..b58eb5f 100644
--- a/mdadm/mdadm/super-intel.c
+++ b/mdadm/mdadm/super-intel.c
@@ -7969,7 +7969,7 @@ exit_imsm_check_reshape_conditions:
 
 int imsm_manage_container_reshape(struct supertype *st)
 {
-	int ret_val = 0;
+	int ret_val = 1;
 	char buf[PATH_MAX];
 	struct intel_super *super = st->sb;
 	struct imsm_super *mpb = super->anchor;
@@ -8028,12 +8028,10 @@ int imsm_manage_container_reshape(struct supertype *st)
 	find_array_minor(info2.name, 1, &current_array);
 	if (current_array < 0) {
 		dprintf("imsm. Error.Cannot get first array.\n");
-		ret_val = 1;
 		goto imsm_manage_container_reshape_exit;
 	}
 	if (imsm_check_reshape_conditions(fd, st, current_array)) {
 		dprintf("imsm. Error. Wrong reshape conditions.\n");
-		ret_val = 1;
 		goto imsm_manage_container_reshape_exit;
 	}
 	raid_disks = info2.array.raid_disks;
@@ -8128,6 +8126,7 @@ int imsm_manage_container_reshape(struct supertype *st)
 			close(fd2);
 			if (ret_val) {
 				dprintf("Reshape is broken (cannot reshape)\n");
+				ret_val = 1;
 				goto imsm_manage_container_reshape_exit;
 			}
 			current_array = -1;
@@ -8156,6 +8155,7 @@ int imsm_manage_container_reshape(struct supertype *st)
 
 						if (imsm_check_reshape_conditions(fd, st, current_array)) {
 							dprintf("imsm. Error. Wrong reshape conditions.\n");
+							ret_val = 1;
 							current_array = -1;
 						}
 					} else
@@ -8205,8 +8205,10 @@ int imsm_manage_reshape(struct supertype *st, char *backup)
 		return ret_val;
 	}
 	ret_val = imsm_manage_container_reshape(st);
-	if (ret_val)
-		unfreeze_container(st);
+	/* unfreeze on error and success
+	 * for any result this is end of work
+	 */
+	unfreeze_container(st);
 
 	return ret_val;
 }

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux