]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Bug fixes to pass test suite
authorNeil Brown <neilb@suse.de>
Wed, 29 Mar 2006 06:28:07 +0000 (06:28 +0000)
committerNeil Brown <neilb@suse.de>
Wed, 29 Mar 2006 06:28:07 +0000 (06:28 +0000)
Signed-off-by: Neil Brown <neilb@suse.de>
Grow.c
Kill.c
test
tests/03r5assemV1
tests/05r1-bitmapfile

diff --git a/Grow.c b/Grow.c
index de53df18559c69fabcabe2f8daa5d627b594e6a1..125606c6e3372f60b7fd65fa440cafe3d87a12cd 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -500,14 +500,21 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
                 * other from happening.  Later we could block
                 * resync for the duration via 'sync_action'...
                 */
-               if (raid_disks >= 0)
+               if (raid_disks > 0) {
                        array.raid_disks = raid_disks;
-               if (size >= 0)
+                       if (ioctl(fd, SET_ARRAY_INFO, &array) != 0) {
+                               fprintf(stderr, Name ": Cannot set raid-devices for %s: %s\n",
+                                       devname, strerror(errno));
+                               return 1;
+                       }
+               }
+               if (size >= 0) {
                        array.size = size;
-               if (ioctl(fd, SET_ARRAY_INFO, &array) != 0) {
-                       fprintf(stderr, Name ": Cannot set device size/shape for %s: %s\n",
-                               devname, strerror(errno));
-                       return 1;
+                       if (ioctl(fd, SET_ARRAY_INFO, &array) != 0) {
+                               fprintf(stderr, Name ": Cannot set device size for %s: %s\n",
+                                       devname, strerror(errno));
+                               return 1;
+                       }
                }
                return 0;
 
@@ -869,8 +876,6 @@ int Grow_restart(struct supertype *st, struct mdinfo *info, int *fdlist, int cnt
                        fd = open(backup_file, O_RDONLY);
                        if (fd<0)
                                continue;
-                       if (lseek(fd, 4096, 0) != 4096)
-                               continue;
                } else {
                        fd = fdlist[i];
                        if (fd < 0)
@@ -909,7 +914,7 @@ int Grow_restart(struct supertype *st, struct mdinfo *info, int *fdlist, int cnt
                /* There should be a duplicate backup superblock 4k before here */
                if (lseek64(fd, -4096, 1) < 0 ||
                    read(fd, buf, 4096) != 4096 ||
-                   memcmp(buf, &bsb, sizeof(buf)) != 0)
+                   memcmp(buf, &bsb, sizeof(bsb)) != 0)
                        continue; /* Cannot find leading superblock */
 
                /* Now need the data offsets for all devices. */
diff --git a/Kill.c b/Kill.c
index 2f28b9901d1dd706424c0a0a949ea716bfd3a880..a4d9562622d4dd2d2e4ce8e82e03312de67a77db 100644 (file)
--- a/Kill.c
+++ b/Kill.c
@@ -50,12 +50,14 @@ int Kill(char *dev, int force, int quiet)
                if (!quiet)
                        fprintf(stderr, Name ": Couldn't open %s for write - not zeroing\n",
                                dev);
+               close(fd);
                return 1;
        }
        st = guess_super(fd);
        if (st == NULL) {
                if (!quiet)
                        fprintf(stderr, Name ": Unrecognised md component device - %s\n", dev);
+               close(fd);
                return 1;
        }
        rv = st->ss->load_super(st, fd, &super, dev);
diff --git a/test b/test
index 307bfb839f7c0f8be7a9d1386ddfd9a6c89c034c..3d722285a6f411e429ce81a5911a5354c5eec57e 100644 (file)
--- a/test
+++ b/test
@@ -63,7 +63,10 @@ fi
 
 # mdadm always adds --quiet, and we want to see any unexpected messages
 mdadm() {
-    $mdadm --quiet "$@"
+    case $* in
+       *-C* ) $mdadm --quiet "$@" --auto=yes;;
+        * )   $mdadm --quiet "$@"
+    esac
 }
 
 # check various things
index 7df277eca78270a046ad101d5d58fc48154b1b1e..7553a4f0b9b56fab6854f57c8fbbe1ffcf6eab22 100644 (file)
@@ -49,7 +49,6 @@ mdadm -As -c $conf
 echo "DEVICE $devlist" > $conf
 mdadm -Db $md1 >> $conf
 eval $tst
-
 mdadm --assemble --scan --config=$conf $md1
 eval $tst
 echo PING >&2
index d2275763b5f743129e12b9af3ef61879593e8d14..59564cb07734fbae321e3cc09fa877f3ef3791ab 100644 (file)
@@ -32,10 +32,10 @@ fi
 mdadm -S $md0
 
 mdadm --assemble -R $md0 --bitmap=$bmf $dev2
+dirty4=`mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
 mdadm $md0 --add $dev1
-check recovery
+#it is too fast# check recovery
 
-dirty4=`mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
 check wait
 sleep 4
 dirty5=`mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`