Commit Graph

112 Commits

Author SHA1 Message Date
Dan Williams a54d52625a update copyright headers
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-10-28 10:55:29 -07:00
Dan Williams 57ed8c9155 Treat all devices at the container level as spares
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>
2008-10-15 14:43:57 -07:00
Dan Williams 36ba7d4849 Allow a uuid of all f's to always match
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>
2008-10-15 14:43:57 -07:00
Dan Williams 27fd627414 imsm: show uuid in ->examine_super()
...and add "auto=md" to the brief output.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-10-15 14:43:56 -07:00
Dan Williams 792449393d non-trivial warn_unused_result fixes, activate_spare
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>
2008-10-15 14:15:52 -07:00
Dan Williams 3f6efecc4c imsm: determine failed indexes from the most up-to-date disk
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>
2008-10-15 14:15:51 -07:00
Dan Williams 47ee5a4566 imsm: manage a list of missing disks
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>
2008-10-15 14:15:51 -07:00
Dan Williams 1ee1e9fc62 imsm: fix mpb_size calculation in write_super_imsm
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>
2008-10-15 14:15:51 -07:00
Dan Williams f8f603f133 imsm: enable checkpointing of migration (resync/rebuild)
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>
2008-10-15 14:15:51 -07:00
Dan Williams 593add1b56 monitor: protect against CONFIG_LBD=n
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>
2008-10-15 14:15:51 -07:00
Dan Williams 14e8215b1b imsm: trust sector reservation from metadata
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>
2008-10-15 14:15:51 -07:00
Dan Williams c92a2527e1 imsm: confirm raid10 layout, fix up handling raid10 failures
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>
2008-10-15 14:15:47 -07:00
Dan Williams 5c3db629a6 imsm: more serial handling fixups
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>
2008-10-15 13:12:17 -07:00
NeilBrown ff54de6e47 Report uuid in --detail --brief for ddf and intel
The uuid is slightly fictitious but needed for array matching.
2008-09-18 16:11:40 +10:00
NeilBrown 51006d8586 Add uuid support for super-intel.
'imsm' does not provide any real uuid, so we synthesise one
from various stable bits of the superblock.
2008-09-18 16:07:32 +10:00
NeilBrown 9362c1c80c Allow metadata handler to report that it doesn't record homehost.
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.
2008-09-18 16:06:41 +10:00
NeilBrown c5afc314e2 Lots of fixes to make incremental assembly of containers work.
So:
  mdadm -I /dev/whatever

will (if appropriate) add whatever to a container, then start
any arrays inside the container.
2008-09-18 16:03:05 +10:00
NeilBrown 352452c364 Handle incremental assembly of containers.
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>
2008-09-18 16:01:57 +10:00
NeilBrown f35f252592 Move calls to SET_ARRAY_INFO to common helper.
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>
2008-09-18 16:01:55 +10:00
NeilBrown 7801ac2092 Factor out add-disk code
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>
2008-09-18 15:13:32 +10:00
NeilBrown 0e60042683 Compile fixes, particularly moving more stuff under MDASSEMBLE
Now 'make everything' works again.
2008-09-18 15:04:47 +10:00
NeilBrown a8473e68c7 Fix compile warning/error.
gcc said:
  error: large integer implicitly truncated to unsigned type

Signed-off-by: NeilBrown <neilb@suse.de>
2008-09-18 14:10:42 +10:00
Dan Williams e553d2a458 imsm: allow a failed disk to be readded
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>
2008-09-15 20:58:42 -07:00
Dan Williams 301406c9fd imsm: use ->getinfo_super() in ->container_content()
* 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>
2008-09-15 20:58:42 -07:00
Dan Williams a67dd8cc58 Allow metadata handlers to communicate desired safemode delay via mdinfo
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-09-15 20:58:42 -07:00
Dan Williams 1f24f03530 imsm: fix up serial handling
* 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>
2008-09-15 20:58:41 -07:00
Dan Williams f9ba0ff124 imsm: only use the device name as a fallback when IMSM_DEVNAME_AS_SERIAL=1
Also ensure that the serial buffer is initialized.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-09-15 20:58:41 -07:00
Dan Williams 0c046afd06 imsm: rectify map handling
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>
2008-09-15 20:58:41 -07:00
Dan Williams 24565c9a99 imsm: fix imsm_delete()
* 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>
2008-09-15 20:58:41 -07:00
Dan Williams b10b37b839 imsm: use IMSM_ORD_REBUILD instead of USABLE flag
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>
2008-09-15 20:58:41 -07:00
Dan Williams be73972fac imsm: introduce set_imsm_ord_tbl_ent()
Collapse all the open coded occurrences.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-09-15 20:58:41 -07:00
Dan Williams fb49eef264 imsm: cleanup arguments to imsm_check_degraded
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-09-15 20:58:41 -07:00
Dan Williams ff077194a1 imsm: cleanup get_imsm_disk_idx(), unify with get_imsm_ord_tbl_ent()
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>
2008-09-15 20:58:41 -07:00
Dan Williams 3e372e5a72 imsm: fix up compare_super_imsm() to match family_num for populated mpb's
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>
2008-09-15 20:58:40 -07:00
Dan Williams e0783b419d imsm: fix up spare handling holdover in update_create_array
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>
2008-09-15 20:55:40 -07:00
Dan Williams 8796fdc4cd imsm: mark failures like the Matrix driver
* 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>
2008-09-15 20:55:34 -07:00
Dan Williams 4d7b1503a7 imsm: provide for a larger mpb buffer when necessary
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>
2008-09-15 20:55:34 -07:00
Dan Williams fb9bf0d3e7 imsm: fix logic inversion in get_imsm_ord_tbl_ent()
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-09-15 20:55:30 -07:00
Dan Williams 6c386dd368 imsm: allow container assembly in the presence of failed disks
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>
2008-08-19 17:55:15 +10:00
Dan Williams 43dad3d6fb mdadm: add device to a container
Adding a device updates the container and then mdmon takes action upon
noticing a change in devices.  This reuses the container version of
add_to_super to create a new record for the device.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2008-08-19 17:19:51 +10:00
Dan Williams ae6aad8239 imsm: delete kicked disks
When we have determined that a disk is no longer of any value, remove
it from the data structure.   This is now safe because the manager
will back off while any metadata update is pending in the monitor.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2008-08-19 14:55:10 +10:00
NeilBrown 01f157d74a Extra option for set_array_state: you choose dirty or clean.
When we first start an array, it might be good to start recovery
straight away.  That requires setting the array to 'dirty', but
only the metadata handler can know if that is required or not.
So have a third possible 'consistent' option to set_array_state.
Either 'no' or 'yes' or 'you choose'.

Return value indicates what was chosen.

'1' (no) should be chosen unless there is a good reason.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-08-19 14:54:55 +10:00
Dan Williams fcb844757f imsm: include not synced disks in imsm_count_failed
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-08-15 10:58:42 -07:00
Dan Williams 7eef045331 imsm: use disk_ord_tbl to identify rebuilding disks
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-08-15 10:57:19 -07:00
Dan Williams 9a1608e5d0 imsm: fix up assembly of disks that are not in-sync
1/ Do not assemble !in_sync or failed devices in container_content.
2/ Prevent activation of failed or configured devices in activate_spare.
3/ Be sure to avoid dirty degraded if the array was shutdown cleanly.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-08-12 02:25:49 -07:00
Dan Williams 6a3e913ee9 imsm: fix create by mdmon-update
imsm_dev dynamically grows, so dev_idx needs to be moved up in the
definition to avoid getting clobbered.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-08-12 02:25:49 -07:00
Dan Williams e74255d907 imsm: write_super return 0 on success
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-08-12 02:25:49 -07:00
Dan Williams a48ac0a8d6 imsm: update mpb_size in write_super_imsm
With dev->vol.map and mpb->disk entries entering and leaving the parameter
block write_super_imsm needs to update the size before writeback.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-08-12 02:25:49 -07:00
Dan Williams 272906ef49 mdmon: use activate spare for re-add
Disks that are not in-sync or failed are not assembled into member
arrays by mdadm.  Teach mdmon to resolve this situation by checking for
spares at start.  imsm_activate_spare() is updated to prefer devices
that can be re-added versus new spares.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-08-12 02:25:46 -07:00
Dan Williams 3393c6af8b imsm: fix handling of the 'migr_state' and 'migr_type' bits
The option-rom and the Matrix driver mark resyncs/rebuilds with the
migrate state bits.  Update sizeof_imsm_dev to allow allocation of
imsm_dev entries large enough to grow if migr_state is later set.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-08-12 02:05:20 -07:00