summaryrefslogtreecommitdiffstats
path: root/mdadm.h
Commit message (Collapse)AuthorAgeFilesLines
* Assemble: allow members of containers to be assembled and auto-assembled.NeilBrown2008-11-041-0/+3
| | | | | | | | | | 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: factor out assemble_container_contentDan Williams2008-11-041-0/+3
| | | | | | | | | 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-1/+0
| | | | | | I have seen the light. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Incremental: lock against multiple concurrent additions to an array.NeilBrown2008-11-041-0/+2
| | | | | | | In two devices are added via -I to one array at the same time, mdadm can get badly confused. Signed-off-by: NeilBrown <neilb@suse.de>
* Manage: when stopping an array, delete all names from /dev.NeilBrown2008-11-041-0/+1
| | | | | | | | | This only applies if udev isn't installed or is disabled by MDADM_NO_UDEV We try to remove partitions too. We find names to remove by looking in /var/run/mdadm/map 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>
* config: Support container=uuid as alternative to container=/dev/name in ↵NeilBrown2008-11-041-2/+3
| | | | | | | | | | mdadm.conf When mdadm.conf is automatically generated, we might not know a suitable /dev/name. But we do know the uuid of the container. So allow that as an option. Signed-off-by: NeilBrown <neilb@suse.de>
* Incremental: adjust to the new naming scheme.NeilBrown2008-11-041-3/+2
| | | | | --incremental now uses exactly the same create_mddev that other code uses.
* mdopen: Introduce new rules for creating device name.NeilBrown2008-11-041-1/+6
| | | | MORE CONTENT HERE
* util: make env checking more genericNeilBrown2008-11-041-1/+1
| | | | | | | 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>
* Delay creation of array devices for assemble/build/createNeilBrown2008-11-041-7/+7
| | | | | | | | | | | | | 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>
* Introduce new open_mddev which just does an open.NeilBrown2008-11-041-0/+1
| | | | | | | Some cases we aren't interested in creating the mddev, just opening it. Make those more explicit. 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/+1
| | | | | | | | | | | | 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>
* Merge branch 'master' into devel-3.0NeilBrown2008-10-271-1/+1
|\ | | | | | | | | | | | | Conflicts: Create.c Manage.c
| * Allow WRITEMOSTLY to be cleared on --readd using --readwrite.NeilBrown2008-10-251-1/+1
| | | | | | | | | | | | | | | | Previously it was possible to set the WRITEMOSTLY flag when adding a device to an array, but not to clear the flag when re-adding. This is now possible with --readwrite. Signed-off-by: NeilBrown <neilb@suse.de>
* | Merge branch 'master' into devel-3.0NeilBrown2008-10-171-1/+3
|\| | | | | | | | | | | Conflicts: Manage.c
| * Improve reporting of layout for raid10.NeilBrown2008-10-131-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | Showing e.g. near=1, far=2 for the 'far2' layout of raid10 is confusing even though there is a sense in which is it correct. Make it less confusing by only printing whichever number is not 1. If both are 1, make that clear too (i.e. no redundancy).
| * Manage: allow adding device that is just large enough to v1.x array.NeilBrown2008-10-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | When adding a device to an array, we check that it is large enough. Currently the check makes sure there is also room for a reasonably sized bitmap. But if the array doesn't have a bitmap, then this test might be too restrictive. So when adding, only insist there is enough space for the current bitmap. When Creating, still require room for the standard sized bitmap. This resolved Debian Bug 500309
* | quiet WaitClean()Dan Williams2008-10-151-1/+1
| | | | | | | | Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Allow a uuid of all f's to always matchDan Williams2008-10-151-0/+1
| | | | | | | | | | | | | | 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>
* | sysfs: dprintf when we fail to write a sysfs fileDan Williams2008-10-151-0/+8
| | | | | | | | | | | | | | When arrays do not startup correctly it would be nice to know why. Need to move the dprintf definition to mdadm.h Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Add support for assembling specific subarrays.NeilBrown2008-09-181-0/+6
| | | | | | | | | | This normally isn't needed as --incremental does all the work. But it is needed to recognise member= and container= in mdadm.conf
* | 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-0/+2
| | | | | | | | | | 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-2/+1
| | | | | | | | | | | | | | 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.
* | Handle incremental assembly of containers.NeilBrown2008-09-181-0/+8
| | | | | | | | | | | | | | | | | | 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>
* | Move calls to SET_ARRAY_INFO to common helper.NeilBrown2008-09-181-2/+3
| | | | | | | | | | | | | | | | | | | | 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-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Teach --detail about containers and members there-of.NeilBrown2008-09-181-0/+1
| | | | | | | | | | | | | | | | | | | | Make --detail on a container more useful by suppressing irrelevant detail and adding useful detail like a list of member arrays. Ditto for members of a container: report the name of the container array. Signed-off-by: NeilBrown <neilb@suse.de>
* | 'mdadm --wait-clean' wait for array to be marked cleanDan Williams2008-09-151-0/+5
| | | | | | | | | | | | | | | | | | For use in distro shutdown scripts with a RAID root file system. Returns immediately if the array is 'readonly', or not an externally managed array. It is up to the distro's scripts to make sure no new writes hit the device after this returns 'true'. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Add ping_monitor() to mdadm --waitDan Williams2008-09-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The action we are waiting for may not be complete until the monitor has had a chance to take action on the result. The following script can now remove the device on the first attempt, versus a few attempts with the original Wait(): #!/bin/bash #export MDADM_NO_MDMON=1 export IMSM_DEVNAME_AS_SERIAL=1 ./mdadm -Ss ./mdadm --zero-superblock /dev/loop[0-3] echo 2 > /proc/sys/dev/raid/speed_limit_max ./mdadm --create /dev/imsm /dev/loop[0-3] -n 4 -e imsm -a md ./mdadm --create /dev/md/r1 /dev/loop[0-3] -n 4 -l 5 --force -a mdp ./mdadm --fail /dev/md/r1 /dev/loop3 ./mdadm --wait /dev/md/r1 x=0 while ! ./mdadm --remove /dev/imsm /dev/loop3 > /dev/null 2>&1 do x=$((x+1)) done echo "removed after $x attempts" ./mdadm --add /dev/imsm /dev/loop3 Include 2 small cleanups: * remove the almost open coded fd2devnum() in Wait() by introducing a new utility routine stat2devnum() * teach connect_monitor() to parse the container device from a subarray string Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Honor safemode_delay at Create() and Incremental() timeDan Williams2008-09-151-0/+1
| | | | | | | | Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Allow metadata handlers to communicate desired safemode delay via mdinfoDan Williams2008-09-151-0/+1
| | | | | | | | Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Allow an externally managed array to be marked readonlyNeilBrown2008-08-191-1/+8
| | | | | | | | | | | | | | | | | | | | | | If the metadata_version is -mdXXX/whatever rather than /mdXXX/whatever then the array is readonly and should be left alone by mdmon. Signed-off-by: NeilBrown <neilb@suse.de>
* | Factor out test for subarray version string.NeilBrown2008-08-191-0/+5
| | | | | | | | | | | | | | We are about to change the syntax of the version string for 'subarray's. So factor out the test into a single function. Signed-off-by: NeilBrown <neilb@suse.de>
* | Extra option for set_array_state: you choose dirty or clean.NeilBrown2008-08-191-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | mdmon: handle failures versus readauto arraysDan Williams2008-08-151-0/+1
| | | | | | | | | | | | | | | | | | Transition readauto arrays to active before failing drives. Hmm... why do we keep reblocking / renotifying in the readonly case? Need to bottom out on this, but not right now. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | mdmon: allow degraded arrays to be monitoredDan Williams2008-08-151-0/+1
| | | | | | | | | | | | | | manage_new is too strict in the face of failed devices. Teach it to monitor degraded arrays. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | sysfs: deprecate sysfs_disk_to_sgDan Williams2008-07-241-1/+0
| | | | | | | | | | | | | | | | | | | | The cmd_filter patch merged for 2.6.27 broke retrieving the serial number via an ioctl to /dev/sgN. In debugging this I found that other utilities like sdparm simply run the ioctl on /dev/sdX. So just convert to that for protection in numbers, but scream on the mailing list for the inconvenience grr... Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Factor common code into new "start_mdmon".NeilBrown2008-07-181-0/+1
| | | | | | | | Signed-off-by: Neil Brown <neilb@suse.de>
* | mdadm: add an environment variable to prevent auto-launching mdmonDan Williams2008-07-141-0/+1
| | | | | | | | | | | | Useful for attaching gdb to mdmon before any action is taken on the array. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Introduce devname2devnumNeil Brown2008-07-121-0/+1
| | | | | | | | and use it instead of opencoding.
* | Pass 'verbose' flag to validate_geometryNeil Brown2008-07-121-1/+2
| | | | | | | | | | That way it can be silent when we are just trying to figure out which metadata to use, and noisy when detecting a real problem.
* | Use O_DIRECT for all IO to devices.Neil Brown2008-07-121-0/+5
| | | | | | | | | | | | | | | | Using buffered IO risks non-atomic updates to parts of the device that we don't actually want to write to. This isn't in general safe. So switch to O_DIRECT for all that IO and make sure we have properly aligned buffers.
* | Create arrays via metadata-updateNeil Brown2008-07-121-0/+14
| | | | | | | | | | Support creating arrays inside an active ddf container by sending a metadata update over a pipe to mdmon.
* | Remove mgr_pipe for communicating from manage to monitor.Neil Brown2008-07-121-1/+0
| | | | | | | | | | Data is being passed in shared memory, so the pipe is only being use as a wakeup. This can more easily be done with a thread-signal.
* | Remove mon_pipe for communicating from monitor to managerNeil Brown2008-07-121-1/+0
| | | | | | | | | | | | The returned value was never used, and we don't really want this return path anyway as writing to a pipe could conceivably block, and the monitor must not block.
* | Handle device removal from containerNeil Brown2008-07-121-0/+1
| | | | | | | | | | | | | | This really should be done in mdadm, not mdmon. We ensure the device won't be suddenly commited as a hot-spare using O_EXCL, then check the 'holders' sysfs directory to make sure it is only in use once.
* | Remove the multiple super_switchs for ddf.Neil Brown2008-07-121-0/+9
| | | | | | | | | | It is simpler if there is just one, and the methods make decisions as appropriate.