Package:        mdadm
Version:        1.9.0-2.1
Severity:       wishlist

The mdadm package can automatically create device files when
assembling drives, provided the auto=md or auto=part7 option
is added to the relevant drives in the configuration file.

It turns out these configuration options are often forgotten
by users, with the result that the mdadm init.d script will
not create these devices, causing bug reports such as #273182.

Thus, there is a need to automatically create these devices
even if that's not specified in the config file.

There is a command line option to do this (mdadm -A -a /dev/md0),
but in combination with the --scan option this does not work.
The reason is that the absence of auto= in config file overrules
the presence on the commandline.  The attached patch changes this
by making the command line --auto option a default for the
configuration file option.

The interaction with auto=md vs auto=part is worth noting.

In the config file, auto values "yes" and "md" mean that
a non-partitionable device must be created; this is represented
in core with '-1'.  "No" and absense of the option mean not to
generate a file; represented by '0'.  "part", "mdp", or "part7"
mean that a partitionable device must be created, represented
by a a positive number that indicates how many partitions are needed.

On the command line, "yes" and "md" are not the same.  "yes" means
that the type must be derived from the filename, (represented by -2),
"md" (is -1) asks explicitly for non-partitionable device.  Like the
config file, auto=part3 is represented by a positive number.  On the
command line, --auto without '=' is interpreted as --auto=yes.

The patch uses the config file value if it differs from no/absent (0),
the command line value otherwise:

        (array_ident->autof ? array_ident->autof : autof));

This means auto=part7 in the config file will overrule a --auto=yes
on the command line.

It also means auto=no in config file is now overridden by --auto=yes.
This differs from previous behaviour, and can't be changed without
changing the representation of auto in RAM.  Let's call this an improvement
rather than a bug.

For devices such as /dev/md-root, the auto=md option in the config file
remains mandatory, since mdadm cannot determine whether partitioning
is necessary based on the file name.  If the option is absent, a suitable
error message is produced.

As an aside, if this patch works OK, it may make sense to have udev
ignore md devices.  That would help in moving from kernel names
(/dev/md0) which are determines by probing order toward symbolic names,
(/dev/md-root) which can be specified based on UUID, and are independent
of the orde in which hardware is detected.

Note that this is lightly tested: interactive use only, test in combination
with a revised init.d script.

Regards,
Erik

--- mdadm-1.9.0/mdadm.c 2005-05-21 18:48:49.000000000 +0200
+++ mdadm-1.9.0-hack/mdadm.c    2005-05-21 20:57:12.000000000 +0200
@@ -732,7 +732,8 @@
                                        devlist->devname);
                                rv |= 1;
                        } else {
-                               mdfd = open_mddev(devlist->devname, 
array_ident->autof);
+                               mdfd = open_mddev(devlist->devname,
+                                               (array_ident->autof ? 
array_ident->autof : autof));
                                if (mdfd < 0)
                                        rv |= 1;
                                else {
@@ -759,7 +760,8 @@
                                        rv |= 1;
                                        continue;
                                }
-                               mdfd = open_mddev(dv->devname, 
array_ident->autof);
+                               mdfd = open_mddev(dv->devname,
+                                               (array_ident->autof ? 
array_ident->autof : autof));
                                if (mdfd < 0) {
                                        rv |= 1;
                                        continue;
@@ -777,7 +779,8 @@
                        } else
                                for (; array_list; array_list = 
array_list->next) {
                                        mdu_array_info_t array;
-                                       mdfd = open_mddev(array_list->devname, 
array_list->autof);
+                                       mdfd = open_mddev(array_list->devname,
+                                                       (array_list->autof ? 
array_list->autof : autof));
                                        if (mdfd < 0) {
                                                rv |= 1;
                                                continue;


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to