]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
FIX: Unfreeze array on success only
authorAdam Kwolek <adam.kwolek@intel.com>
Thu, 10 Mar 2011 07:30:42 +0000 (08:30 +0100)
committerNeilBrown <neilb@suse.de>
Mon, 14 Mar 2011 07:12:57 +0000 (18:12 +1100)
Unfreeze array on success only.
rv is initialized by restart variable so we have 2 cases.
1. regular reshape start
rv == restart == 0
   this means that real error (returned by reshape) can cause leaving container frozen
   If array is not touched by reshape it can be unfrozen
2. During reshape restart even untouched array under reshape is left unfrozen,
   If reshape is started do not unfreeze array on error also.

This allows user for array repair action
(mdmon will not change array state).

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

diff --git a/Grow.c b/Grow.c
index 9b4d5fbdcecb7981c1acc53eae2dc2f8460b6f19..40e693edfbf3c6c39e655be17d674b4900bf9728 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -2205,6 +2205,7 @@ int reshape_container(char *container, char *devname,
                      int quiet, int restart)
 {
        struct mdinfo *cc = NULL;
+       int rv = restart;
 
        /* component_size is not meaningful for a container,
         * so pass '-1' meaning 'no change'
@@ -2249,7 +2250,6 @@ int reshape_container(char *container, char *devname,
                 * will take over the reshape.
                 */
                struct mdinfo *content;
-               int rv;
                int fd;
                struct mdstat_ent *mdstat;
                char *adev;
@@ -2292,7 +2292,8 @@ int reshape_container(char *container, char *devname,
                if (rv)
                        break;
        }
-       unfreeze(st);
+       if (!rv)
+               unfreeze(st);
        sysfs_free(cc);
        exit(0);
 }