summaryrefslogtreecommitdiffstats
path: root/Assemble.c
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* | Assemble: revert preliminary -As supportDan Williams2008-11-041-46/+0
| | | | | | | | | | | | I have seen the light. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Assemble: replace 'info' with 'content'Dan Williams2008-11-041-80/+82
| | | | | | | | | | | | | | | | 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>
* | Quiet unitialized variable warningsDan Williams2008-11-041-1/+1
| | | | | | | | | | Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* | assemble: fix setting of 'foreign' trustability.NeilBrown2008-11-041-0/+7
| |
* | Assemble: Fix naming of container devices.NeilBrown2008-11-041-5/+6
| | | | | | | | | | | | | | | | Container devices are meant to be named for the metadata type. That wasn't happening properly for DDF. Signed-off-by: NeilBrown <neilb@suse.de>
* | Generate 'change' uevents when arrays change in non-obvious ways.NeilBrown2008-11-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | When a 'container' gets started, we need udev to notice, but the kernel has no way of knowing that a KOBJ_CHANGE event is needed. So send one directly via the 'uevent' sysfs attribute. Also, uevents don't get generated when md arrays are stopped (prior to 2.6.28) so send 'change' events then too. Signed-off-by: NeilBrown <neilb@suse.de>
* | Always update mdadm/map when starting an array.NeilBrown2008-11-041-1/+10
| | | | | | | | | | | | | | | | We previously only updated /var/run/mdadm/map when starting an array with --incremental. However we now make more use of that file (to pass the dev name to udev) so always update it. Signed-off-by: NeilBrown <neilb@suse.de>
* | Incremental: adjust to the new naming scheme.NeilBrown2008-11-041-1/+2
| | | | | | | | | | --incremental now uses exactly the same create_mddev that other code uses.
* | mdopen: Introduce new rules for creating device name.NeilBrown2008-11-041-51/+25
| | | | | | | | MORE CONTENT HERE
* | assemble: combine the two create_mddev calls in to one.NeilBrown2008-11-041-71/+56
| | | | | | | | | | | | This delays the create_mddev call even further in the case where an array device name is given for --assemble. It is now delayed until the 'name' of the array is also available.
* | Delay creation of array devices for assemble/build/createNeilBrown2008-11-041-30/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | We will shortly be feeding more information into the process of creating array devices, so delay the creation. Still open them early if the device already exists. This involves making sure the autof flag is in the right place so that it can be found at creation time. Also, Assemble, Build, and Create now always close 'mdfd'. Signed-off-by: NeilBrown <neilb@suse.de>
* | Rename open_mddev to create_mddevNeilBrown2008-11-041-2/+2
| | | | | | | | | | | | | | This reflect that fact that more often than not it is creating things in /dev, and allows for a new open_mddev which does just that. Signed-off-by: NeilBrown <neilb@suse.de>
* | Preliminary -As support for container member arraysDan Williams2008-10-281-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | Given an mdadm.conf like the following allow /dev/imsm and /dev/md/r1 to be created by "mdadm -As". DEVICES partitions ARRAY /dev/imsm metadata=imsm auto=md UUID=b98f5dbe-aa859e7b-0e369b89-a80986d4 ARRAY /dev/md/r1 container=/dev/imsm member=0 auto=mdp UUID=3538e39c-b397c2e9-1aa031f9-2bc0eca4 spares=1 Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Treat all devices at the container level as sparesDan Williams2008-10-151-1/+1
| | | | | | | | | | | | | | | | | | 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>
* | trivial warn_unused_result squashingDan Williams2008-10-151-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Made the mistake of recompiling the F9 mdadm rpm which has a patch to remove -Werror and add "-Wp,-D_FORTIFY_SOURCE -O2" which turns on lots of errors: config.c:568: warning: ignoring return value of asprintf Assemble.c:411: warning: ignoring return value of asprintf Assemble.c:413: warning: ignoring return value of asprintf super0.c:549: warning: ignoring return value of posix_memalign super0.c:742: warning: ignoring return value of posix_memalign super0.c:812: warning: ignoring return value of posix_memalign super1.c:692: warning: ignoring return value of posix_memalign super1.c:1039: warning: ignoring return value of posix_memalign super1.c:1155: warning: ignoring return value of posix_memalign super-ddf.c:508: warning: ignoring return value of posix_memalign super-ddf.c:645: warning: ignoring return value of posix_memalign super-ddf.c:696: warning: ignoring return value of posix_memalign super-ddf.c:715: warning: ignoring return value of posix_memalign super-ddf.c:1476: warning: ignoring return value of posix_memalign super-ddf.c:1603: warning: ignoring return value of posix_memalign super-ddf.c:1614: warning: ignoring return value of posix_memalign super-ddf.c:1842: warning: ignoring return value of posix_memalign super-ddf.c:2013: warning: ignoring return value of posix_memalign super-ddf.c:2140: warning: ignoring return value of write super-ddf.c:2143: warning: ignoring return value of write super-ddf.c:2147: warning: ignoring return value of write super-ddf.c:2150: warning: ignoring return value of write super-ddf.c:2162: warning: ignoring return value of write super-ddf.c:2169: warning: ignoring return value of write super-ddf.c:2172: warning: ignoring return value of write super-ddf.c:2176: warning: ignoring return value of write super-ddf.c:2181: warning: ignoring return value of write super-ddf.c:2686: warning: ignoring return value of posix_memalign super-ddf.c:2690: warning: ignoring return value of write super-ddf.c:3070: warning: ignoring return value of posix_memalign super-ddf.c:3254: warning: ignoring return value of posix_memalign bitmap.c:128: warning: ignoring return value of posix_memalign mdmon.c:94: warning: ignoring return value of write mdmon.c:221: warning: ignoring return value of pipe mdmon.c:327: warning: ignoring return value of write mdmon.c:330: warning: ignoring return value of chdir mdmon.c:335: warning: ignoring return value of dup monitor.c:415: warning: rv may be used uninitialized in this function ...some of these like the write() ones are not so trivial so save those fixes for the next patch. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Report uuid in --detail --brief for ddf and intelNeilBrown2008-09-181-1/+1
| | | | | | | | The uuid is slightly fictitious but needed for array matching.
* | Use uuid as /dev name when assembling array of uncertain origin.NeilBrown2008-09-181-6/+25
| | | | | | | | | | If we aren't sure that the array belongs to 'this' host, use the uuid to choose a name to avoid any conflict.
* | Allow metadata handler to report that it doesn't record homehost.NeilBrown2008-09-181-1/+2
| | | | | | | | | | | | | | 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.
* | Move calls to SET_ARRAY_INFO to common helper.NeilBrown2008-09-181-28/+8
| | | | | | | | | | | | | | | | | | | | 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>
* | Factor out add-disk codeNeilBrown2008-09-181-8/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Compile fixes, particularly moving more stuff under MDASSEMBLENeilBrown2008-09-181-1/+1
| | | | | | | | Now 'make everything' works again.
* | Remove getinfo_super_n and do some other cleaning up.Neil Brown2008-07-121-8/+3
| | | | | | | | | | Getting close to a sensible description of what some of the superswitch methods are supposed to do!
* | Remove 'major' from superswitch.Neil Brown2008-07-121-4/+4
| | | | | | | | It isn't generally meaningful.
* | Merge branch 'master' into devel-3.0Neil Brown2008-06-191-9/+17
|\| | | | | | | | | | | Conflicts: Makefile
| * Fix bug in forced assemble.Chris Webb2008-06-191-1/+1
| | | | | | | | | | | | | | From: Chris Webb <chris@arachsys.com> We are loading into the already-loaded 'st' instead of the newly create 'tst', which is clearly wrong.
| * Avoid NULL reference calling free_super and elsewhere.Neil Brown2008-05-271-5/+7
| | | | | | | | | | | | | | Since we made free_super a superswitch call, we need to be careful that st is non NULL before calling st->ss->free_super(st). Also when updating byteorder there is a chance of a similar NULL deref.
| * Remove stray semicolonNeil Brown2008-05-271-1/+1
| | | | | | | | Causes compile error with gcc-2.95
| * Fix autoassemble for stack arrays.Neil Brown2008-05-201-3/+9
| | | | | | | | | | | | | | | | If you have stacked arrays, then mdadm -As --homehost=fred should work but doesn't. It gets into an infinite loop! So write some tests, and fix the bugs.
* | Remove st->text_version in favour of info->text_versionNeil Brown2008-05-271-1/+1
| | | | | | | | | | | | | | I want the metadata handler to have more control over the 'version', particularly for arrays which are members of containers. So discard st->text_version and instead use info->text_version which getinfo_super can initialise.
* | Remove 'fd' arg from sysfs_add_diskNeil Brown2008-05-271-13/+6
| | | | | | | | | | It it never used, and removing means there are several 'open's that can go.
* | Remove stray semicolonNeil Brown2008-05-271-1/+1
| | | | | | | | Causes compile error with gcc-2.95