]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Grow: move error message closer to error cause.
authorNeilBrown <neilb@suse.de>
Tue, 18 May 2010 02:29:28 +0000 (12:29 +1000)
committerNeilBrown <neilb@suse.de>
Tue, 18 May 2010 02:29:28 +0000 (12:29 +1000)
A recent change move the sysfs_read call away from the check that it
succeeded.  This patch moves the check back next to the sysfs_read
call.

Signed-off-by: NeilBrown <neilb@suse.de>
Grow.c

diff --git a/Grow.c b/Grow.c
index 0916c5de236e5260827b812509a64181df7c8942..28ed8d7390cdf3267ace5795ea96c8d99c384cb2 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -948,6 +948,13 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
                                 GET_COMPONENT|GET_DEVS|GET_OFFSET|GET_STATE|
                                 GET_CACHE);
 
+               if (!sra) {
+                       fprintf(stderr, Name ": %s: Cannot get array details from sysfs\n",
+                               devname);
+                       rv = 1;
+                       break;
+               }
+
                if (ndata == odata) {
                        /* Make 'blocks' bigger for better throughput, but
                         * not so big that we reject it below.
@@ -960,13 +967,6 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
                        fprintf(stderr, Name ": Need to backup %luK of critical "
                                "section..\n", blocks/2);
 
-               if (!sra) {
-                       fprintf(stderr, Name ": %s: Cannot get array details from sysfs\n",
-                               devname);
-                       rv = 1;
-                       break;
-               }
-
                if (blocks >= sra->component_size/2) {
                        fprintf(stderr, Name ": %s: Something wrong - reshape aborted\n",
                                devname);