summaryrefslogtreecommitdiffstats
path: root/Assemble.c
Commit message (Collapse)AuthorAgeFilesLines
* Assemble: Fix honouring of 'auto' config lineNeilBrown2010-07-061-0/+1
| | | | | | | | | | | | | | commit 1ff98339283645a20c980d540f6c4d82693e7daf broke the checking of metadata types via the 'auto' line. Be moving 'load_super" before "conf_test_metadata" we left tst->sb set even if conf_test_metadata fails, so the device will actually be accepted and used. So if we decide to reject the device, free the superblock so it is clear that it is rejected. Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble: fix some recently introduced bugs.NeilBrown2010-03-101-10/+17
| | | | | | | | Found during testing: - cannot check metadata for homehost before loading metadata. - As 1.x metadata can has a state 'rebuilding' between 'spare' and 'ok', we need to include that in our calculations. Signed-off-by: NeilBrown <neilb@suse.de>
* config: add 'homehost' option to 'AUTO' line.NeilBrown2010-03-031-1/+2
| | | | | | This allows basing auto-assembly decisions on whether the array is recorded as belonging to this host or not. Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble: clean up properly if we cannot add the bitmap file.NeilBrown2010-02-241-0/+4
| | | | | | | If we find we cannot add the requested bitmap file when assembling the array, then make sure to clean up properly and don't leave a half-configured array. Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble: check inargv before complaining about stray arguments.NeilBrown2010-02-241-1/+1
| | | | | | | | | | | | | | | If --assemble is given a container and some other devices to assemble an array from, it complains with an error because that doesn't make sense. However it currently also complains if the list of devices was extract from the config file rather than being given on the command line. That is not appropriate. So add an '&& inargv' test to ensure that we are really complaining about the right thing. Signed-off-by: NeilBrown <neilb@suse.de> Acked-by: Dan Williams <dan.j.williams@intel.com>
* Assemble: fix --force assembly of v1.x arrays which are recovering.NeilBrown2010-02-041-1/+3
| | | | | | | | | | | | | | | | 1.x metadata allows a device to be a member of the array while it is still recoverying. So it is a working member, but is not completely in-sync. mdadm/assemble does not understand this distinction and assumes that a work member is fully in-sync for the purpose of determining if there are enough in-sync devices for the array to be functional. So collect the 'recovery_start' value from the metadata and use it in assemble when determining how useful a given device is. Reported-by: Mikael Abrahamsson <swmike@swm.pp.se> Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble: error-check ->load_superNeilBrown2010-01-281-2/+16
| | | | | | | | Once load_super has succeeded, it should continue to succeed. However devices can disappear etc so it is prudent to always check the return status of load_super. Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble: fix testing of 'verbose' flag.NeilBrown2009-11-191-2/+2
| | | | | | | The 'verbose' flag can be negative, meaning 'quiet'. So never check for != 0. Signed-off-by: NeilBrown <neilb@suse.de>
* Replace all relevant occurrences of -4 with LEVEL_MULTIPATHNeilBrown2009-11-171-2/+2
| | | | | | Also -1 -> LEVEL_LINEAR. Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble: include ACTIVE but not in-sync devices as non-spares.NeilBrown2009-11-171-1/+1
| | | | | | | | | Previously such things did not exist: ACTIVE and SYNC were either both set or both clear. Recent changes with reshape means that a device can be ACTIVE but not yet fully in-sync, so they need to be handled and included in the array as active devices. Signed-off-by: NeilBrown <neilb@suse.de>
* Merge branch 'master' into devel-3.1NeilBrown2009-10-221-0/+27
|\
| * Assemble: handle container members betterNeilBrown2009-10-191-0/+18
| | | | | | | | | | | | | | When looking for a specific member, don't accept a different member, but step on to the next one. Signed-off-by: NeilBrown <neilb@suse.de>
| * Assemble: print verbose messages when finding members in containersNeilBrown2009-10-191-0/+6
| | | | | | | | | | | | .. so that "-Av" gives more hints at what is going on. Signed-off-by: NeilBrown <neilb@suse.de>
| * imsm: add --update=uuid supportDan Williams2009-10-131-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When disks have conflicting container memberships (same container ids but incompatible member arrays) --update=uuid can be used to move offenders to a new container id by changing 'orig_family_num'. Note that this only supports random updates of the uuid as the actual uuid is synthesized. We also need to communicate the new 'orig_family_num' value to all disks involved in the update. A new field 'update_private' is added to struct mdinfo to allow this information to be transmitted. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Compile fixes for mdassembleNeilBrown2009-10-201-0/+2
| | | | | | | | Signed-off-by: NeilBrown <neilb@suse.de>
* | Assemble: print more verbose messages about restarting a reshapeNeilBrown2009-10-201-1/+5
| | | | | | | | Signed-off-by: NeilBrown <neilb@suse.de>
* | Merge branch 'master' into devel-3.1NeilBrown2009-10-011-7/+6
|\| | | | | | | | | Conflicts: mdadm.8
| * Assemble: fix handling of empty containerDan Williams2009-08-041-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | # mdadm --create /dev/md/ddf /dev/sd[b-e] -n 4 -e ddf mdadm: container /dev/md/ddf prepared. # mdadm -Ss mdadm: stopped /dev/md126 # mdadm -As mdadm: Container /dev/md/ddf0 has been assembled with 4 drives Segmentation fault Reported-by: Artur Wojcik <artur.wojcik@intel.com> Reported-by: Jacek Danecki <jacek.danecki@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * Update copyright dates and remove references to @cse.unsw.edu.auNeilBrown2009-06-021-7/+2
| | | | | | | | | | | | Also removed 'paper' addresses. Signed-off-by: NeilBrown <neilb@suse.de>
| * mdadm.8: Man page updatesNeilBrown2009-06-021-0/+2
| | | | | | | | General review and update of mdadm.8
* | Grow: support restart of new migrations.NeilBrown2009-08-131-1/+14
|/
* Be more consistent about keeping the host: prefix on array names.NeilBrown2009-05-111-0/+5
| | | | | | | | | | | | If an array name contains a "hostname:" prefix, then --assemble will tend to leave it there, while --incremental will strip it off (when chosing a device name during auto-assembly). Make this more consistent: strip the name off if we decide that the name will be treated as 'local'. Leave it on if it will be treated as 'foreign'. Signed-off-by: NeilBrown <neilb@suse.de>
* Allow homehost to be largely ignored when assembling arrays.NeilBrown2009-05-111-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | If mdadm.conf contains HOMEHOST <ignore> or commandline contains --homehost=<ignore> then the check that array metadata mentions the given homehost is replace by a check that the name recorded in the metadata is not already used by some other array mentioned in mdadm.conf. This allows more arrays to use their native name rather than having an _NN suffix added. This should only be used during boot time if all arrays required for normal boot are listed in mdadm.conf. If auto-assembly is used to find all array during boot, then the HOMEHOST feature should be used to ensure there is no room for confusion in choosing array names, and so it should not be set to <ignore>. Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble/Incr : minor tidy up of setting 'trustworthy'.NeilBrown2009-05-111-10/+4
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Fix tests on ->container and ->memberNeilBrown2009-05-111-2/+2
| | | | | | | | For container= and member= to be effective in an mdadm.conf line they must both be present. So when checking for their absence we need container != NULL || member != NULL. Signed-off-by: NeilBrown <neilb@suse.de>
* conf/assemble: new config line "auto".NeilBrown2009-05-111-0/+7
| | | | | | | | | | | | | | | | | | | The line 'auto' in mdadm.conf can be used to disable assembly of specific metadata types, or of all arrays. This does not affect assembly of arrays listed in mdadm.conf or on command line. auto -all will disable all auto-assembly. auto -ddf will cause mdadm to ignore ddf arrays that are not explicitly mentioned, and auto assemble anything else it finds. Signed-off-by: NeilBrown <neilb@suse.de>
* assemble: support arrays created with --homehost=anyNeilBrown2009-05-111-1/+2
| | | | | | | | | | | | | If an array is created with --homehost=any, then --assemble and --incremental will treat it as being local to 'this' host, no matter what the name of this host is. This is useful for array that will be given unique names and be moved between machines. This needs to be documented. Signed-off-by: NeilBrown <neilb@suse.de>
* incremental_container: preserve 'in_sync' flag when adding to existing array.NeilBrown2009-04-141-1/+1
| | | | | | | | | | | When building container members with -IR, we need to ensure that devices added to an active array preserve the 'in_sync' status so they don't needlessly get rebuilt. So allow sysfs_add_disk to do this (only works in kernels since 2.6.30) and pass the relevant flag down. Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble: call map_update even when not starting the array.NeilBrown2009-04-071-4/+7
| | | | | | | For incremental assembly to work, we need to keep the 'map' up-to-date even when not starting the array yet. Signed-off-by: NeilBrown <neilb@suse.de>
* wait_for improvement.NeilBrown2009-04-071-3/+3
| | | | | | | | wait not only for the name to appear, but for it to refer to the correct device. Sometimes old symlinks left lying around can be confusing. Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble/container: catch errors when starting a partial container.NeilBrown2009-03-101-11/+21
| | | | | | | | | | | If we are assembling an array in a container and it isn't complete enough to start yet, then - don't start mdmon - don't say the array is started - don't wait for the device to appear in /dev Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble: fix busy detectionDan Williams2009-01-201-2/+1
| | | | | | | | | | | | | | Use mddev_busy() as GET_ARRAY_INFO can succeed on 'clear' arrays. Ran into this after an encountering a case where mdadm -Ss ended in segfault (missing check for NULL return from map_by_devnum() in sles11:Manage.c). So, tried to stop the array by hand with echo clear > md/array_state, after which I could not reassemble since GET_ARRAY_INFO was succeeding. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Merge branch 'devel' of ↵NeilBrown2008-12-181-0/+1
|\ | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/djbw/mdadm into devel-3.0
| * wait_for container assemblyDan Williams2008-12-081-0/+1
| | | | | | | | Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Merge branch 'master' into devel-3.0NeilBrown2008-12-181-0/+16
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | Conflicts: Assemble.c Incremental.c Kill.c ReadMe.c inventory mapfile.c mdadm.8 mdadm.spec mdassemble.8
| * Assemble: set stripe_cache_size properly when restarting a reshape.NeilBrown2008-12-181-0/+14
| | | | | | | | | | | | | | | | Reshape with large chunk size can require a large stripe_cache. We make this work when starting the reshape but not when restarting at assemble time. So fix that. Signed-off-by: NeilBrown <neilb@suse.de>
| * Assemble: don't assume array is 'clean' unless all devices think it is.NeilBrown2008-12-181-0/+2
| | | | | | | | | | | | | | | | This is only significant for --assemble --force where some old devices might be included into the array. If anything looks like it isn't clean, the kernel will not allow a degraded array to be started. Signed-off-by: NeilBrown <neilb@suse.de>
* | Merge branch 'master' into devel-3.0NeilBrown2008-11-271-2/+0
|\|
| * Assemble: allow --force to work even when event counts are 0.NeilBrown2008-11-271-2/+0
| | | | | | | | | | | | | | | | | | | | If any superblocks in a confused array had an event count of 0, "mdadm -Af" would not update the event counts to assemble the array. I don't remember why that text is there, and it has caused at least one situation to be difficult to recover from. So remove the test. --force means --force! Signed-off-by: NeilBrown <neilb@suse.de>
* | Assemble: wait for device to appear via udevNeilBrown2008-11-271-0/+1
| | | | | | | | | | | | | | Use the new "wait_for" function to make sure udev has created the device before completion the 'assemble'. Signed-off-by: NeilBrown <neilb@suse.de>
* | Assemble: close mdfd before returning from assemble_container_contentNeilBrown2008-11-071-3/+8
| | | | | | | | | | | | This makes sure it is consistently closed. Signed-off-by: NeilBrown <neilb@suse.de>
* | Assemble: return correct status from assemble_container_content.NeilBrown2008-11-071-4/+5
| | | | | | | | | | | | Otherwise autoassembly can get confused. Signed-off-by: NeilBrown <neilb@suse.de>
* | Assemble: fix some auto-assemble bugs.NeilBrown2008-11-071-5/+8
| | | | | | | | | | | | | | 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>
* | Wait for name to appear after create/assemble etc.NeilBrown2008-11-041-3/+5
| | | | | | | | | | | | | | We don't really want mdadm to exit until udev has created the names in /dev. So wait. Signed-off-by: NeilBrown <neilb@suse.de>
* | Assemble: we were missing a 'close'NeilBrown2008-11-041-0/+1
| | | | | | | | Signed-off-by: NeilBrown <neilb@suse.de>
* | Assemble: revise detection of 'autoassemble' mode.NeilBrown2008-11-041-1/+3
| | | | | | | | | | | | | | | | 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>
* | Assemble: allow members of containers to be assembled and auto-assembled.NeilBrown2008-11-041-1/+90
| | | | | | | | | | | | | | | | | | | | 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>
* | Assemble: simplify test for reporting mismatches.NeilBrown2008-11-041-11/+13
| | | | | | | | | | | | | | Rather than open-coding a test of 'verbose' and 'inargv' in multiple places, do it one and set a variable. Signed-off-by: NeilBrown <neilb@suse.de>
* | Assemble: block attempts to reassemble container membersDan Williams2008-11-041-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Assemble: factor out assemble_container_contentDan Williams2008-11-041-0/+68
| | | | | | | | | | | | | | | | | | 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>