Make sure every failure from add_to_super prints a suitable
error message, and then don't print any error in the caller.
Signed-off-by: NeilBrown <neilb@suse.de>
Its cumbersome to determine which devices to wait for in a system shutdown
script, so hook up --scan.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Auto-assembly and planned assembly don't really work well together,
it can be confusing.
In particular in mkinitrd or similar creates an mdadm.conf to
assemble a particular array, we shouldn't go assembling any
other arrays as well.
If you want auto assembly, you need to give mdadm a config
file with no ARRAY lines.
mdadm -Ascpartitions
can do this.
Signed-off-by: NeilBrown <neilb@suse.de>
Now that names in /dev are usually created (eventually) by udev,
it isn't really safe to rely in finding a name in /dev to pass to
mdmon to identify which array to monitor.
And it isn't really necessary to have a name in /dev.
So just pass the symbolic name, e.g. md127 or md123.
Change util.c to pass that name, and change mdmon to process the
name sensibly.
Signed-off-by: NeilBrown <neilb@suse.de>
Resolves issues like:
mdadm -Ss
mdadm: unable to open /dev/md/r1: No such file or directory
...where /dev/md/r1 points to a removed device.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Change the multibyte disk status field definitions to imsm byte-order
(little-endian) to match other multibyte field definitions.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1/ when we choose not to use a device, must set ->used to 2, not 1.
2/ When we give up on a member, clear st and content.
Signed-off-by: NeilBrown <neilb@suse.de>
Not all kernels automatically discard partitions when the
array is stopped, so call the RRPART ioctl to force it.
Signed-off-by: NeilBrown <neilb@suse.de>
It is possible for the mapfile to become wrong, and that gets
very confusing. So validate entries before returning them.
Signed-off-by: NeilBrown <neilb@suse.de>
If udev hasn't created the array yet, we might still want to
open it. So open directly by major:minor.
Also, of array in map file doesn't appear to exist, do use
the name associated with it.
Signed-off-by: NeilBrown <neilb@suse.de>
So if the array with minor number matching the name of a new array
already exists, just assemble with a different minor number.
Signed-off-by: NeilBrown <neilb@suse.de>
As we open and close so quickly, udev might still have the device
open. so call udevsettle before stopping an array during testing.
Signed-off-by: NeilBrown <neilb@suse.de>
When we create our own ddf array, store the homehost in the vendor
information so it can be so to ensure 'LOCAL' name choices.
Signed-off-by: NeilBrown <neilb@suse.de>
As with Assemble, one create_mddev has chosen a name, we should always
use that rather than the passed 'mddev'.
Signed-off-by: NeilBrown <neilb@suse.de>
As spares are treated quite differently in containers, we cannot
fake-up a spare to optimise initialisation for a raid5 in a container,
so disable that code for ->external arrays.
Signed-off-by: NeilBrown <neilb@suse.de>
Rather than appending the md minor number, we now append a small
sequence number to make sure name in /dev/md/ that aren't LOCAL are
unique. As the map file is locked while we do this, we are sure
of no losing any races.
Signed-off-by: NeilBrown <neilb@suse.de>
We probably should pass a flag down saying 'this is auto-assembly',
but for now, if there is no identity information set, it must
be auto-assemble.
Signed-off-by: NeilBrown <neilb@suse.de>
Try to treat members of containers much like other arrays for
assembly.
We still look through the list of devices for a match (it will be
the container), then find the relevant 'info' and try to assemble
the array.
Signed-off-by: NeilBrown <neilb@suse.de>
Attempting to open(O_EXCL) each candidate device usually filters out all
busy raid components. However, containers do not behave like components
and will return container_content that may describe active member
arrays.
This patch just adds a function that will be used to check if a
container member is busy. It will be used shortly.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Factor out, from Incremental_container, the code for assembling an
array based on information extracted from a container. We will
shortly use this from Assemble too.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
In preparation for handling the container case where we may need to handle
a list of potential member arrays.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Add anything that looks like a container in /proc/mdstat to the devlist
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>