Thread (23 messages) 23 messages, 2 authors, 2010-11-24
STALE5703d
Revisions (2)
  1. v1 current
  2. v1 [diff vs current]

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

From: Adam Kwolek <hidden>
Date: 2010-11-23 12:40:02
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
---

 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;
 }
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help