Change the "env_check_mdmon" function to be more generic, accepting
and environment variable name, as soon we will have a new use for it.
Signed-off-by: NeilBrown <neilb@suse.de>
If a spare is included in the list of examined disks we need to copy in at
least enough information to get the uuid of the populated container.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This prevents a uuid of all f's from being displayed when an imsm spare is
listed along with active disks for mdadm -Eb.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Examine() is actually looking at the ACTIVE bit. This happened to work for
imsm spares but now it needs to be fixed up.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Raid disk and disk number information is not relevant at the container
level, especially for imsm. So arrange for getinfo_super_imsm() to
always publish devices as spares and report the number of spares at
Assemble() time.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
The uuid returned for an imsm spare device will never match the uuid of an
active disk. So make mdadm interpret a uuid of all f's as "match any".
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Both super-ddf and super-intel ignore memory allocation failures during
->activate_spare. Fix these up by cancelling the activation.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
load_imsm_disk() currently notices if spares missed their activation
update, but we allow a stale failed disk back in to the array because its
serial number is clobbered in the most up-to-date disk.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
If a drive is removed while mdmon is not running we need a way to
identify what is missing and mark that disk as failed in the metadata.
At ->load_super() time create a list of missing disks defined as a disk
that is marked in-sync yet does not appear in super->disks.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Spotted a thinko... raid devices are dynamically sized, disks are not.
The space for disks is always mpb->num_disks * sizeof(struct imsm_disk).
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
When the array is shutdown, or when mdadm --wait-clean is called, any
active resync process will be idled allowing mdmon to record the current
resync position.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
md/resync_start reports different terminal values depending on kernel
configuration (~0UL versus ~0ULL). Make detection of the
resync-complete state more robust by comparing against array size.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
On ich6r the option-rom appears to reserve only 432 sectors rather than
the 418+4096 of newer implementations. For compatibility trust the
metadata in these cases.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1/ near-2 indeed matches how the Windows driver lays out the data
2/ update imsm_check_degraded to check for rebuilding disks in the
raid10 case
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
zero-initialize the serial buffer to handle cases where the response is
less than MAX_RAID_SERIAL_LEN.
Tested-by: Jacek Danecki <jacek.danecki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
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.
mdadm -I /dev/part-of-container
should add that to a container, creating if it needed,
and then try to assemble any arrays in the container.
Signed-off-by: NeilBrown <neilb@suse.de>
When we assemble an array, there are three different approaches
depending on whether metadata is internal or external, and on
kernel version.
Move all this to a common helper instead of duplicating in 3 places.
Signed-off-by: NeilBrown <neilb@suse.de>
The variety of approaches to 'add_disk' are factored out into
a separate function, and Incremental mode benefits by being
closer to supporting the assembly of containers.
Also remove the adding-to-array-data-structure out of sysfs_add_disk
and into add_disk.
And add some tests for --incremental mode to make sure we don't break it.
Signed-off-by: NeilBrown <neilb@suse.de>
Allow the following sequence to rebuild the array
mdadm --fail /dev/md/r1 /dev/disk
mdadm --remove /dev/imsm /dev/disk
mdadm --add /dev/imsm /dev/disk
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* allows container_content() to pick up the safemode_delay
* removes some duplicate code
* fixes an endian bug setting info->array.chunk_size
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Trim trailing and leading whitespace
* Allow unterminated serial numbers up to MAX_RAID_SERIAL_LEN
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
The secondary map is used to reflect the migration state of the array
i.e. from dev->vol.map[1] to dev->vol.map[0]. Ensure a rebuilding /
initializing array is marked in the second map, while normal status is
reflected in the first map. Also mark rebuilding drives with
IMSM_ORD_REBUILD.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* fix breakage from last merge (infinite loop in imsm_process_update())
* add ability to delete by index
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
IMSM_ORD_REBUILD is the 'insync' flag in MD terms. USABLE is a flag to
opt-in disks for use with the Windows driver.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Save some unnecessary calls to get_imsm_map() by teaching
get_imsm_disk_idx() to retrieve the map.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This allows spares to be associated with any family while not allowing
disks from different families to be assembled.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
We used to leave SPARE_DISK unset to indicate it was available to be
assimilated into other arrays. Now we explicitly check the size.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Truncate the first character of the serial number
* Set 'scsi_id' to all f's
* Expect to find disk entries with unmatchable serial numbers, i.e.
expect get_imsm_disk() to return NULL in some situations
* Allow discrepencies between mpb->num_disks and len(super->disks)
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Ensure that the mpb buffer is large enough to hold the extra imsm_map's
of migrating arrays and dynamically created raid devices.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
For example, this allows one to still say mdadm -A /dev/sd[b-e] even
though /dev/sde has replaced /dev/sdd. Otherwise mdadm will say:
mdadm: superblock on /dev/sdd doesn't match others - assembly aborted
Signed-off-by: Dan Williams <dan.j.williams@intel.com>