Change update to enum in update_super and update_subarray Use already existing enum, change update_super and update_subarray update to enum globally. Refactor function references also. Remove code specific options from update_options. Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
Don't associate spares with other arrays during RAID Examine Spares in imsm belong to containers, not volumes, and must go into a separate container when assembling the RAID. Remove association spares with other arrays and make Examine print separate containers for spares. Auto assemble without config file already works like this. So make creating a config file and assembling from it consistent with auto assemble. With this change, mdadm -Es will add this line to output if spares are found: ARRAY metadata=imsm UUID=00000000:00000000:00000000:00000000 Signed-off-by: Oleksandr Shchirskyi <oleksandr.shchirskyi@linux.intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
imsm: add verbose flag to compare_super IMSM does more than comparing metadata and errors reported directly from compare_super_imsm can be useful. Add verbose flag to compare_super method and make all not critical error printing configurable. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
examine: tidy up some code. Michael Shigorin reports that the 'lcc' compiler isn't able to deduce that 'st' must be initialized in if (c->SparcAdjust) st->ss->update_super(st, NULL, "sparc2.2", just because the only times it isn't initialised, 'err' is set non-zero. This results in a 'possibly uninitialised' warning. While there is no bug in the code, this does suggest that maybe the code could be made more obviously correct. So this patch: 1/ moves the "err" variable inside the for loop, so an error in one device doesn't stop the other devices from being processed 2/ calls 'continue' early if the device cannot be opened, so that a level of indent can be removed, and so that it is clear that 'st' is always initialised before being used 3/ frees 'st' if an error occured in load_super or load_container. Reported-by: Michael Shigorin <mike@altlinux.org> Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
Examine: split 'verbose' out from 'brief'. The value of 'verbose' is sometimes mixed into 'brief', particularly for Examine. This is messy and confusing. So keep them separate. 'brief' still gets assumed when 'scan' is set, unless we are very verbose. Signed-off-by: NeilBrown <neilb@suse.de>
Remove scattered checks for malloc success. malloc should never fail, and if it does it is unlikely that anything else useful can be done. Best approach is to abort and let some super-daemon restart. So define xmalloc, xcalloc, xrealloc, xstrdup which don't fail but just print a message and exit. Then use those removing all the tests for failure. Also replace all "malloc;memset" sequences with 'xcalloc'. Signed-off-by: NeilBrown <neilb@suse.de>
examine: allows to examine a disk metadata on non-metadata compliant systems Allow for loading metadata from disk attached to non-metadata compliant system. Affects mdadm --examine and guess_super. Added ignore_hw_compat in supertype to pass information to load_super handler. If ignore_hw_compat is set the handler should load metadata also from disks that do not comply with metadata requirements (i.e. disk is not attached to native controller, etc). Signed-off-by: Marcin Labun <marcin.labun@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
Don't close fds in write_init_super We previously closed all 'fds' associated with an array in write_init_super .. sometimes, and sometimes at bad times. This isn't neat and free_super is a better place to close them. So make sure free_super always closes the fds that the metadata manager kept hold of, and stop closing them in write_init_super. Also add a few more calls to free_super to make sure they really do get closed. Reported-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
get_info_super: report which other devices are thought to be working/failed. To accurately detect when an array has been split and is now being recombined, we need to track which other devices each thinks is working. We should never include a device in an array if it thinks that the primary device has failed. This patch just allows get_info_super to return a list of devices and whether they are thought to be working or not. Signed-off-by: NeilBrown <neilb@suse.de>
Add mbr pseudo metadata handler. To support incorpating a new bare device into a collection of arrays - one partition each - mdadm needs a modest understanding of partition tables. The main needs to be able to recognise a partition table on one device and copy it onto another. This will be done using pseudo metadata types 'mbr' and 'gpt'. Signed-off-by: NeilBrown <neilb@suse.de>
Examine: don't count containers as spares mdadm -Ebs will include containers in the scanned device list. Examine() falsely thinks they are spares when MD_DISK_SYNC is not set. This could be fixed by forcing all formats to set this flag for container devices, but this flag is currently used by imsm to identify free-floating spares. Signed-off-by: Dan Williams <dan.j.williams@intel.com>