summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
| * Revert "Make the IMSM_DEVNAME_AS_SERIAL option work when creating containers."Dan Williams2010-03-031-4/+1
| | | | | | | | | | | | | | This reverts commit 9ef5dbff4adc7979102e71efe8efd83d8e0dc775 as it is duplicating the check that is done internal to imsm_read_serial(). Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Stop: done stop a container which still have members active.NeilBrown2010-03-091-0/+21
| | | | | | | | | | | | Doing that is just confusing... Signed-off-by: NeilBrown <neilb@suse.de>
* | Make sure reshape_active is cleared by getinfo_superNeilBrown2010-03-092-0/+2
| | | | | | | | | | | | There were cases where --detail would report phantom reshapes. Signed-off-by: NeilBrown <neilb@suse.de>
* | mdmon.8: minor manpage updateNeilBrown2010-03-091-0/+5
| | | | | | | | Signed-off-by: NeilBrown <neilb@suse.de>
* | mdadm.8: improve hosthost documentationNeilBrown2010-03-091-0/+19
| | | | | | Signed-off-by: NeilBrown <neilb@suse.de>
* | Grow: fix problem with validating chunk sizeNeilBrown2010-03-091-2/+2
| | | | | | | | | | | | | | When checking if the new chunk size fit in the component size we were confusing sectors and K, and so getting it wrong. Signed-off-by: NeilBrown <neilb@suse.de>
* | Improve partition table code.NeilBrown2010-03-091-21/+49
| | | | | | | | | | | | | | | | | | | | Code to check partition tables used some needless casts and was broken, using a u8 when a u32 was wanted. So create structure describing the tables rather than using offset, and read into those tables instead. Signed-off-by: NeilBrown <neilb@suse.de>
* | mdadm.8: correct typo: pairtyRyo Fujita2010-03-081-1/+1
|/ | | | Signed-off-by: NeilBrown <neilb@suse.de>
* super1: encourage data alignment on 1Meg boundaryNeilBrown2010-03-031-12/+40
| | | | | | | | | | | | | For 1.1 and 1.2 metadata where data_offset is not zero, it is important to align the data_offset to underlying block size. We don't currently have access to the particular device in avail_size so just try to force to a 1Meg boundary. Also default 1.x metadata to 1.2 as documented. Signed-off-by: NeilBrown <neilb@suse.de>
* config: add 'homehost' option to 'AUTO' line.NeilBrown2010-03-037-24/+70
| | | | | | 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>
* Manage: fix regression on removing detached devices.NeilBrown2010-03-031-7/+15
| | | | | | | | | | | | If /dev is static, a name may remain there after the device has been detached from the system. Using 'mdadm' to remove such a device from the array should still work (even though "mdadm --remove detached" might be preferred). So when processing a device for '-r', don't insist on being able to open the device. Signed-off-by: NeilBrown <neilb@suse.de>
* allow redefinition of VAR_RUNLuca Berra2010-03-032-1/+14
| | | | | | | having mdmon socket under var is painful at shutdown time Signed-off-by: Luca Berra <bluca@comedia.it> Signed-off-by: NeilBrown <neilb@suse.de>
* mdmon: Check both RUN directories to find running mdmonNeilBrown2010-03-031-12/+9
| | | | | | | | | | If mdmon is run without "--takeover", it should still check both *_RUN directories for a valid 'pid' file to guard against having two mdmons running at the same time. Suggested-by: Luca Berra <bluca@comedia.it> Signed-off-by: NeilBrown <neilb@suse.de>
* mdmon: check select a writable pid_dirLuca Berra2010-03-031-13/+12
| | | | | | | | Check that either VAR_DIR or ALT_DIR is actually writable before selecting it. Signed-off-by: Luca Berra <bluca@comedia.it> Signed-off-by: NeilBrown <neilb@suse.de>
* fix mdmon takeoverLuca Berra2010-03-032-3/+3
| | | | | | | | | | | - when we waited for the old mdmon to exit, we didn't look for the socket in the right place - when we failed to find a pid file, we returned the wrong value (code expected <0, but got ==0). Signed-off-by: Luca Berra <bluca@comedia.it> Signed-off-by: NeilBrown <neilb@suse.de>
* fix mdmon option parsingLuca Berra2010-03-032-7/+19
| | | | | | | | | | | running mdmon --takeover --all resulted in a segfault. Also allow "--all" to be longer so that e.g. md_d127 can successfully over-write it in the argument list visible to 'ps'. Signed-off-by: Luca Berra <bluca@comedia.it> Signed-off-by: NeilBrown <neilb@suse.de>
* Add _FORTIFY_SOURCE to mdadm.O2 build.NeilBrown2010-03-034-20/+44
| | | | | | | | | | When building mdadm.O2, set _FORTIFY_SOURCE to get more warnings, and also build mdmon.O2 to find warnings in that code too. Then fix the warnings. Suggested-by: Luca Berra <bluca@comedia.it> Signed-off-by: NeilBrown <neilb@suse.de>
* Fix warning about unused variable.NeilBrown2010-03-031-1/+4
| | | | | | Warning only appears with -O2, but is invalid. Signed-off-by: NeilBrown <neilb@suse.de>
* fix gcc warnings about strict-aliasing rulesNeilBrown2010-03-031-2/+5
| | | | | Original-by: Luca Berra <bluca@comedia.it> 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>
* Create: change default metadata type to 1.2NeilBrown2010-02-242-3/+3
| | | | | | | | | | | | | Change default - again, sorry. v1.1 causes problems as the conflicts with a boot sector, whether on the whole device or in a partition. I guess the rule is they you aren't allowed to use the first sector in general. v1.2 is mostly just as good and avoid boot-sector problems so default to that instead. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: be more relaxed about timestamp mismatches on backup file.NeilBrown2010-02-241-4/+16
| | | | | | | | | As backup file has a timestamp which is updated quite separately from the metadata timestamp. They should be largely in-sync but sometimes are not. So be more generous in the check, and allow it to be over-ridden by an environment variable. 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>
* super1: put bitmap on a 4K boundary when possible.NeilBrown2010-02-241-8/+7
| | | | | | | | Some devices have 4K sector sizes. So try to align the bitmap on a 4K boundary. This isn't possible when hot-adding a bitmap, but will be once we add support for configuring the bitmap via sysfs. Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble: Handle assembling from config file which is out of order.NeilBrown2010-02-242-15/+37
| | | | | | | | | | | | Currently "mdadm -As" will process the entries in the config file in order. If any array is a component or member of a preceding array, that array will not be assembled. So if there are any failures during assembly, retry those arrays, and look until everything is assembled, or nothing more can be assembled. Signed-off-by: NeilBrown <neilb@suse.de>
* mdmon: Document startup/shutdown requirements in man page.NeilBrown2010-02-081-1/+58
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* mapfile: use ALT_RUN as alternate place to store mapfileNeilBrown2010-02-081-4/+4
| | | | | | This gives better consistency and fewer hidden '.' files. Signed-off-by: NeilBrown <neilb@suse.de>
* mdmon: insist on creating .pid file at startup.NeilBrown2010-02-084-45/+34
| | | | | | | | | | | | | | | | Now that we don't "mdadm --takeover" until /var/run is writable there is no need to continually try to create files in there. So only create these files at startup and fail if they cannot be made. This means that to start an array with externally managed metadata, either /var/run or ALT_RUN (e.g. /lib/init/rw) must be writable. To 'takeover' from a previous mdmon instance, /var/run must be writable. This means we don't need to worry about SIGHUP (which was once used to tell us it was time to create .pid) and SIGALRM. Signed-off-by: NeilBrown <neilb@suse.de>
* mdmon: don't monitor /proc/mounts to decide when to create .pid file.NeilBrown2010-02-083-15/+4
| | | | | | | | | | | Monitoring /proc/mounts and creating a .pid file as soon as /var/run is writable is racy. Most distros clean all non-directories from /var/run early in boot and if mdmon races with this it could lose the files as soon as they are created. Instead require that "mdmon --takeover" be run after /var is writable. Signed-off-by: NeilBrown <neilb@suse.de>
* mdmon: remove switch-root functionality.NeilBrown2010-02-082-136/+56
| | | | | | | | | | | | | | | | | Using switch-root and then creating files in /var/run once that location is writable is racing as most distro clean out /var/run shortly after it is mounted. This can cause the .pid and .sock files to be deleted shortly after they are created. This option doesn't seem to be used at all any, and the alternative of communicating the pid etc in some preserved directory and then restarting mdmon once all is settled seems simpler. So remove the code for supporting switchroot and update man page accordingly. Signed-off-by: NeilBrown <neilb@suse.de>
* mdmon: recognise --all in place of /proc/mdstatNeilBrown2010-02-042-3/+6
| | | | | | | It seems more meaningful. Keep the old option as well for back compatibility. Signed-off-by: NeilBrown <neilb@suse.de>
* mdmon: allow pid to be stored in different directory.NeilBrown2010-02-049-34/+121
| | | | | | | | /var/run probably doesn't persist from early boot. So if necessary, store in in /lib/init/rw or somewhere else that does persist. Signed-off-by: NeilBrown <neilb@suse.de>
* Having single function to read mdmon pid file.NeilBrown2010-02-043-41/+11
| | | | | | | We don't need three. One (signal_mdmon) wasn't even being used. Signed-off-by: NeilBrown <neilb@suse.de>
* mdmon: discard test_pidfile()NeilBrown2010-02-041-12/+4
| | | | | | | | devname2mdmon() can be used just as easily and doing so saves us from some duplicate code. Also tidy up some related logic. Signed-off-by: NeilBrown <neilb@suse.de>
* mdmon: don't mkdir /var/runNeilBrown2010-02-041-2/+0
| | | | | | | | | Creating /var/run in mdmon is really not justifiable. If /var/run doesn't exist, then it is either deliberate and it should be left that way to make sure the mapfile gets created in /dev, or it is a configuration error and not our problem to fix. Signed-off-by: NeilBrown <neilb@suse.de>
* mdmon: improve switchroot handling.NeilBrown2010-02-041-20/+41
| | | | | | | | | | | | | The change to get mdmon to re-exec itself from the switchroot filesystem broken switchroot in various ways. This fixes it. If the switchroot path is not '/', mdmon will find the pid and socket for the monitor, chroot to the new root, and exec mdmon passing the pid in argv[2] and the socket in stdin. If the switchroot path is actually a number, mdmon will not chroot, but will kill that pid before taking over the array. Signed-off-by: NeilBrown <neilb@suse.de>
* mdmon: simplify try_kill_monitorNeilBrown2010-02-041-8/+7
| | | | | | | | After we SIGTERM the monitor we need to wait for it to finish up. Rather than the complexity of waiting for every md array to be clean, we can simply read from the sock connected to the monitor. When the monitor dies, we will get EOF. Before then we will block. Signed-off-by: NeilBrown <neilb@suse.de>
* mdmon: remove scan variable from mdmon()NeilBrown2010-02-041-7/+5
| | | | | | | | | It is redundant as each place that it is used, it can only have one possible value. Also change the related arg to mdmon() to have a more meaningful name. And make mdmon() static. Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble: fix --force assembly of v1.x arrays which are recovering.NeilBrown2010-02-045-1/+13
| | | | | | | | | | | | | | | | 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>
* Create: Improve warning message about booting from v1.xNeilBrown2010-02-011-2/+2
| | | | | | | | | | | Suggesting that if your boot loaded doesn't support v1.x, then use --metadata=1.0 doesn't make a lot of sense. Also, '/', isn't really important, it is /boot that matters. Hopefully people who have /boot on '/' realise that /boot is on '/' .... Signed-off-by: NeilBrown <neilb@suse.de>
* Add test for "are we running as root".NeilBrown2010-02-011-0/+6
| | | | | | | | | | | Most operations require root access. Rather than ensure we generate the right error message when something fails because we aren't root, check early. Note that "--examine" does not necessarily require root, so test for that first. Resolves-Debian-bug: 396570 Signed-off-by: NeilBrown <neilb@suse.de>
* super-intel.c: use %zu specifier for printf of size_tLuca Berra2010-02-011-1/+1
| | | | | | | | Fix compile warning when size_t is not a long. Acked-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Luca Berra <bluca@vodka.it> Signed-off-by: NeilBrown <neilb@suse.de>
* mdadm-3.1.1 segfaults when mdadm -G -Z is used.Luca Berra2010-02-011-3/+3
| | | | | Signed-off-by: Luca Berra <bluca@vodka.it> Signed-off-by: NeilBrown <neilb@suse.de>
* Kill: fix when zeroing busy devices.Artur Wojcik2010-01-292-3/+6
| | | | | | | | | mdadm should not wait indefinitely when it trys to reset superblock on device which is busy (cannot be opened). Acked-by: Andre Noll <maan@systemlinux.org> Signed-off-by: Artur Wojcik <artur.wojcik@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* mapfile: fix locking.NeilBrown2010-01-291-2/+5
| | | | | | | | | | | The current locking uses lockf, and is completely broken. When you hold a lockf lock, any close of any fd on that file will release the lock. So map_read() call which is made as soon as we get the lock, will immediately drop the lock. So change to flock locking which isn't so badly designed. Signed-off-by: NeilBrown <neilb@suse.de>
* Detail: Report state of FAILED when an array has too few devices to work.NeilBrown2010-01-291-32/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We already have a call to 'enough' in Detail which is the check for "do we have enough devices". We just need to calculate the required data a bit earlier, then use the same 'enough' call to possibly print FAILED. This is motivated by Debian bug 495755. The other request in that bug is not practical. It would be very nice if output of `mdadm' is more clear in case of a broken array. Currently the only hint you get from `mdadm' that your array is broken is this: # mdadm -A /dev/md0 /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1 mdadm: /dev/md0 assembled from 1 drive and 3 spares - not enough to start the array. It could say something like `Your array is broken, you can't use it anymore' It is not valid to report that array as 'broken' if the user hasn't listed all the devices, which could be the case here. Resolves-Debian-Bug: 495755 Signed-off-by: NeilBrown <neilb@suse.de>
* Tidy up some argument parsing, particularly for -bNeilBrown2010-01-293-20/+19
| | | | | | | -b only means --brief in MISC mode, elsewhere it is --bitmap. Resolves-debian-bug: 427777 Signed-off-by: NeilBrown <neilb@suse.de>
* md.4: various improvements to new section on scrubbing.NeilBrown2010-01-291-22/+19
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* mdmon: fix fd leak and possible buffer overrun.NeilBrown2010-01-291-5/+5
| | | | | | | We normally wouldn't close 'fd', and as 'buf' might not have had a nul, strstr could have overrun it. Signed-off-by: NeilBrown <neilb@suse.de>
* Correctly parse -N command line option.NeilBrown2010-01-281-3/+3
| | | | | | | | 'N' wasn't listed in the sort options, so you had to use --name :-) Resolved-Debian-Bug: 564004 Signed-off-by: NeilBrown <neilb@suse.de>