]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Incremental: fix setting of 'autof' flag.
authorNeilBrown <neilb@suse.de>
Wed, 29 Oct 2008 22:34:06 +0000 (09:34 +1100)
committerNeilBrown <neilb@suse.de>
Wed, 29 Oct 2008 22:34:06 +0000 (09:34 +1100)
When doing auto-assembly, the 'autof' flag from array lines
in mdadm.conf was being ignored.

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

index 5d26b77f5c1ab1b0e9ea9006bb994d7f5610642d..d61518ab83bd7e37f350de2c10211c4430d48d7c 100644 (file)
@@ -83,12 +83,8 @@ int Incremental(char *devname, int verbose, int runstop,
        int dfd, mdfd;
        char *avail;
        int active_disks;
-
-
        struct createinfo *ci = conf_get_create_info();
 
-       if (autof == 0)
-               autof = ci->autof;
 
        /* 1/ Check if devices is permitted by mdadm.conf */
 
@@ -221,6 +217,16 @@ int Incremental(char *devname, int verbose, int runstop,
        /* - Choose a free, high number. */
        /* - Use a partitioned device unless strong suggestion not to. */
        /*         e.g. auto=md */
+
+       /* There are three possible sources for 'autof':  command line,
+        * ARRAY line in mdadm.conf, or CREATE line in mdadm.conf.
+        * They have precedence in that order.
+        */
+       if (autof == 0 && match)
+               autof = match->autof;
+       if (autof == 0)
+               autof = ci->autof;
+
        if (match && (rv = is_standard(match->devname, &devnum))) {
                devnum = (rv > 0) ? (-1-devnum) : devnum;
        } else if ((mp = map_by_uuid(&map, info.uuid)) != NULL)