]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Fix but when assembling v1 arrays
authorNeil Brown <neilb@suse.de>
Mon, 15 Aug 2005 06:35:38 +0000 (06:35 +0000)
committerNeil Brown <neilb@suse.de>
Mon, 15 Aug 2005 06:35:38 +0000 (06:35 +0000)
Because raid_disk and disk.number are not longer in-sync,
it needed some work.

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
16 files changed:
Assemble.c
tests/00raid1
tests/00raid10
tests/01r5fail
tests/02r1add
tests/02r1grow
tests/02r5grow
tests/02r6grow
tests/03r5assem
tests/04r0update
tests/05r1-bitmapfile
tests/05r1-grow-external
tests/05r1-internalbitmap
tests/05r1-n3-bitmapfile
tests/06r5swap
tests/06wrmostly

index 7ef1cd4bf8ad57e659d3548011ea644e43db3d65..6a044b212c2360ecdbc23a2fa005bec8128801ce 100644 (file)
@@ -101,6 +101,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
                int uptodate;
                int state;
                int raid_disk;
+               int disk_nr;
        } *devices;
        int *best = NULL; /* indexed by raid_disk */
        unsigned int bestcnt = 0;
@@ -182,7 +183,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
 
                if (ident->devices &&
                    !match_oneof(ident->devices, devname)) {
-                       if (inargv || verbose > 0)
+                       if ((inargv && verbose>=0) || verbose > 0)
                                fprintf(stderr, Name ": %s is not one of %s\n", devname, ident->devices);
                        continue;
                }
@@ -194,7 +195,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
                
                dfd = open(devname, O_RDONLY|O_EXCL, 0);
                if (dfd < 0) {
-                       if (inargv || verbose > 0)
+                       if ((inargv && verbose >= 0) || verbose > 0)
                                fprintf(stderr, Name ": cannot open device %s: %s\n",
                                        devname, strerror(errno));
                } else if (fstat(dfd, &stb)< 0) {
@@ -207,10 +208,10 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
                                devname);
                        close(dfd);
                } else if (!tst && (tst = guess_super(dfd)) == NULL) {
-                       if (inargv || verbose > 0)
+                       if ((inargv && verbose >= 0) || verbose > 0)
                                fprintf(stderr, Name ": no recogniseable superblock\n");
                } else if (tst->ss->load_super(tst,dfd, &super, NULL)) {
-                       if (inargv || verbose > 0)
+                       if ((inargv && verbose >= 0) || verbose > 0)
                                fprintf( stderr, Name ": no RAID superblock on %s\n",
                                         devname);
                        close(dfd);
@@ -221,35 +222,35 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
 
                if (ident->uuid_set &&
                    (!super || same_uuid(info.uuid, ident->uuid, tst->ss->swapuuid)==0)) {
-                       if (inargv || verbose > 0)
+                       if ((inargv && verbose >= 0) || verbose > 0)
                                fprintf(stderr, Name ": %s has wrong uuid.\n",
                                        devname);
                        continue;
                }
                if (ident->name[0] &&
                    (!super || strncmp(ident2.name, ident->name, 32)!=0)) {
-                       if (inargv || verbose > 0)
+                       if ((inargv && verbose >= 0) || verbose > 0)
                                fprintf(stderr, Name ": %s has wrong name.\n",
                                        devname);
                        continue;
                }
                if (ident->super_minor != UnSet &&
                    (!super || ident->super_minor != info.array.md_minor)) {
-                       if (inargv || verbose > 0)
+                       if ((inargv && verbose >= 0) || verbose > 0)
                                fprintf(stderr, Name ": %s has wrong super-minor.\n",
                                        devname);
                        continue;
                }
                if (ident->level != UnSet &&
                    (!super|| ident->level != info.array.level)) {
-                       if (inargv || verbose > 0)
+                       if ((inargv && verbose >= 0) || verbose > 0)
                                fprintf(stderr, Name ": %s has wrong raid level.\n",
                                        devname);
                        continue;
                }
                if (ident->raid_disks != UnSet &&
                    (!super || ident->raid_disks!= info.array.raid_disks)) {
-                       if (inargv || verbose > 0)
+                       if ((inargv && verbose >= 0) || verbose > 0)
                                fprintf(stderr, Name ": %s requires wrong number of drives.\n",
                                        devname);
                        continue;
@@ -305,6 +306,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
                devices[devcnt].oldminor = info.disk.minor;
                devices[devcnt].events = info.events;
                devices[devcnt].raid_disk = info.disk.raid_disk;
+               devices[devcnt].disk_nr = info.disk.number;
                devices[devcnt].uptodate = 0;
                devices[devcnt].state = info.disk.state;
                if (most_recent < devcnt) {
@@ -484,7 +486,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
                        continue;
                if (!devices[j].uptodate)
                        continue;
-               info.disk.number = i;
+               info.disk.number = devices[j].disk_nr;
                info.disk.raid_disk = i;
                info.disk.state = desired_state;
 
index 01e4241ce91d07aae92d301ef99efb1564411724..af40da4ce95fe5fad9a72e1e81fc568034eb51b6 100644 (file)
@@ -2,7 +2,6 @@
 # create a simple mirror
 # test version0, version1, and no super
 # test resync and recovery.
-set -e
 
 mdadm -CR $md0 -l 1 -n2 $dev0 $dev1 
 check resync
index fe781bafeae2ad4131c4fc03cbf126348c00e5d2..6fffb7413e4f0a09e79bd3c3acdac5db88fdf395 100644 (file)
@@ -1,4 +1,3 @@
-set -ex
 
 # Create some raid10 arrays, all with 6 devices and one spare
 devs="$dev0 $dev1 $dev2 $dev3 $dev4 $dev5 $dev6"
index 5c76a0bb3465ffe2f3fdae76f370aa6526894be5..89cd56156a205f9ac885a2859fd2a42b6174862c 100644 (file)
@@ -1,5 +1,4 @@
 
-set -e
 
 # create a raid5, fail and remove a drive during initial sync
 # Add two more, fail and remove one
index 6b2b212d7488bd64111ac1840f5b082bef4d9c1b..c07ec9775da498874c3b5631c1aa99ae2670dc2e 100644 (file)
@@ -1,5 +1,4 @@
 
-set -e
 # Make a raid1,  add a device, then remove it again.
 
 mdadm -CR $md0 -l1 -n2 -x1 $dev0 $dev1 $dev2  
index e789707fcf5eb0d0146e9d3d31c6c5181245c3b1..e187b0ae2baf900e82b14dfaffe370bf769ecadf 100644 (file)
@@ -1,5 +1,4 @@
 
-set -e
 
 # create a small raid1 array, make it larger.  Then make it smaller
 
index b8de3d4c87ad12fd1d03a02f66e709c483714d94..47bc83ebb92b60d75cb454e2f27ff61be44ec1f9 100644 (file)
@@ -1,5 +1,4 @@
 
-set -e
 
 # create a small raid5 array, make it larger.  Then make it smaller
 
index 6f4cce2e357ff87eb4fbeae9c6c0e464e9054c19..897f510c290ae513b6002cc0dd47b15df133523b 100644 (file)
@@ -1,5 +1,4 @@
 
-set -e
 
 # create a small raid6 array, make it larger.  Then make it smaller
 
index b2b06986220945ddb765cadfc21085399a52edfc..be26cf15460e731d3526f7dc5e8c072d5bd65cdd 100644 (file)
@@ -1,4 +1,3 @@
-set -e
 
 # create a raid5 array and assemble it in various ways,
 # including with missing devices.
index 2a6939df3d8978ff8a2ccd4a5373f855b53faedf..23c7d6560b24d28679f9702e174bc2a12b827fb3 100644 (file)
@@ -1,4 +1,3 @@
-set -e
 
 # create a raid0, re-assemble with a different super-minor
 mdadm -CR $md0 -l0 -n3 $dev0 $dev1 $dev2 
index ac952c23b91e5c53a06bf81ec0a9a30c86e72d70..d2275763b5f743129e12b9af3ef61879593e8d14 100644 (file)
@@ -1,4 +1,3 @@
-set -e
 
 # 
 # create a raid1 with a bitmap file
index 072dc3cca5fac8da19390fc820b04104f7c708b5..ba9b3e5996c34221e03c437b96b71f247eea5e8e 100644 (file)
@@ -1,4 +1,3 @@
-set -e
 
 #
 # create a raid1 array, add an external bitmap
index 0f8a43a5bfcb390789a7b1b9c79c383668a53cd8..19549c50de7174b2c416a304157e8314781971d2 100644 (file)
@@ -1,4 +1,3 @@
-set -e
 
 # 
 # create a raid1 with an internal bitmap
index ec72decd7dd77a4168ba11bc5791b4f51489b16c..a76a91922bc285fbb8ef5b8ac0b4e0e0c77c06d9 100644 (file)
@@ -1,4 +1,3 @@
-set -e
 
 # 
 # create a raid1 with 3 devices and a bitmap file
index e3aaa64b63c997a7d90bf87fb03b4fce9d088ac2..41e8be682992cea5d863bf9eeee978b14e9aecee 100644 (file)
@@ -1,4 +1,3 @@
-set -e
 
 # make a raid5 array, byte swap the superblocks, then assemble...
 
index 929610cc74dee0b36e09e84d380bd48ad87b82c4..34be60d4bc0e61529cedf1e979b9d6179de2cd63 100644 (file)
@@ -1,4 +1,3 @@
-set -e
 
 # create a raid1 array with a wrmostly device