]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Allow metadata handler to report that it doesn't record homehost.
authorNeilBrown <neilb@suse.de>
Thu, 18 Sep 2008 06:06:41 +0000 (16:06 +1000)
committerNeilBrown <neilb@suse.de>
Thu, 18 Sep 2008 06:06:41 +0000 (16:06 +1000)
For now, this means that the lack of a homehost doesn't always prevent
assembly.
Soon we will allow assembly anyway, but have different messages if
homehost isn't supported.

Assemble.c
Incremental.c
mdadm.h
super-intel.c

index 65a679b650e1e7af29487c279f53161f51adbd7d..148ddbf79c6df55869bb7e6b7bb8068c13fb1fa8 100644 (file)
@@ -339,7 +339,8 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
                        if (homehost) {
                                int first = st->ss->match_home(st, homehost);
                                int last = tst->ss->match_home(tst, homehost);
-                               if (first+last == 1) {
+                               if (first != last &&
+                                   (first == 1 || last == 1)) {
                                        /* We can do something */
                                        if (first) {/* just ignore this one */
                                                if ((inargv && verbose >= 0) || verbose > 0)
index d7eeafc17da594e4064949440217bfdf360fc3de..f57c9bb15da606b2a93362916e0e65243184a2f2 100644 (file)
@@ -217,7 +217,7 @@ int Incremental(char *devname, int verbose, int runstop,
        /* 3a/ if not, check for homehost match.  If no match, reject. */
        if (!match) {
                if (homehost == NULL ||
-                   st->ss->match_home(st, homehost) == 0) {
+                   st->ss->match_home(st, homehost) != 1) {
                        if (verbose >= 0)
                                fprintf(stderr, Name
              ": not found in mdadm.conf and not identified by homehost.\n");
diff --git a/mdadm.h b/mdadm.h
index 5bc41e81d3bbd8fc6b3ef46d3a7b4d13028a74a4..7c73b6ac2cf07004236b3e2145facdeb7dc5df03 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -446,8 +446,7 @@ extern struct superswitch {
        void (*getinfo_super)(struct supertype *st, struct mdinfo *info);
 
        /* Check if the given metadata is flagged as belonging to "this"
-        * host.  For arrays that don't determine a minor-number, this
-        * can always be true (??)
+        * host.  0 for 'no', 1 for 'yes', -1 for "Don't record homehost"
         */
        int (*match_home)(struct supertype *st, char *homehost);
 
index ff86e0943933205d723c7b9e95412a90489028a2..f632bcfe67631e8caf105b507ebded80685ec71e 100644 (file)
@@ -578,7 +578,7 @@ static int match_home_imsm(struct supertype *st, char *homehost)
 {
        printf("%s\n", __FUNCTION__);
 
-       return 0;
+       return -1;
 }
 
 static void uuid_from_super_imsm(struct supertype *st, int uuid[4])