]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
FIX: Add error message in container_reshape()
authorAdam Kwolek <adam.kwolek@intel.com>
Thu, 15 Dec 2011 03:34:46 +0000 (14:34 +1100)
committerNeilBrown <neilb@suse.de>
Thu, 15 Dec 2011 03:34:46 +0000 (14:34 +1100)
Add proper error message for container reshape when device cannot be opened.
fd variable operation is moved down to display information what particular
device cannot be opened.

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 70b273445cc5fad95372508964500782dd689bdc..28f82b1092b926e0616f39353dfff9cd78ac3c57 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -2538,15 +2538,19 @@ int reshape_container(char *container, char *devname,
                if (!content)
                        break;
 
-               fd = open_dev(mdstat->devnum);
-               if (fd < 0)
-                       break;
                adev = map_dev(dev2major(mdstat->devnum),
                               dev2minor(mdstat->devnum),
                               0);
                if (!adev)
                        adev = content->text_version;
 
+               fd = open_dev(mdstat->devnum);
+               if (fd < 0) {
+                       printf(Name ": Device %s cannot be opened for reshape.",
+                              adev);
+                       break;
+               }
+
                if (last_devnum == mdstat->devnum) {
                        /* Do not allow for multiple reshape_array() calls for
                         * the same array.