summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* 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>
* md.4: add section on scrubbing and mismatch counts.NeilBrown2010-01-281-0/+109
| | | | | | This relates to debian bug 405919 Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: If bitmap interferes with grow, report this.NeilBrown2010-01-281-7/+28
| | | | | | | | | | If a bitmap exists on an array, then current kernels cannot grow that array. So when we try to grow an array, test for EBUSY and if a bitmap is present, report that the bitmap needs to be removed. Resolves-Debian-Bug: 534571 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>
* Remove stray debugging printfsNeilBrown2010-01-281-2/+4
| | | | | | | | | These were never supposed to be released, and due to a type issue they cause compile problems on some architectures. Resolves-Debian-Bug: 567167 Signed-off-by: NeilBrown <neilb@suse.de>
* Fix segfault when the AUTO keyword is used in the config fileDoug Ledford2010-01-191-1/+10
| | | | | Signed-off-by: Doug Ledford <dledford@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Don't use %02d as a metadata format specifier for metadata numbers.Doug Ledford2010-01-191-3/+3
| | | | | | | It confuses us when we read the output back later Signed-off-by: Doug Ledford <dledford@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Make the IMSM_DEVNAME_AS_SERIAL option work when creating containers.Doug Ledford2010-01-191-1/+4
| | | | | | | | This allows a person to testing using loopback devices that don't support serial number queries. Signed-off-by: Doug Ledford <dledford@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Document validity of --assume-clean when all devices are zeroed.Michael Evan2009-12-301-0/+6
| | | | | | | | | | | | | | | | >> >> When I assemble an array I tend to have checked the devices before >> hand; it would not be difficult to make the final pass a zeroing pass >> if I knew I could vastly speed up post-assembly performance.  As I >> stated, it's merely a lack of clarity in the documentation. > > If you would like to create a patch against the man page, I would be happy to > accept it. > > NeilBrown Signed-off-by: NeilBrown <neilb@suse.de>
* Merge branch 'klockwork' of git://github.com/djbw/mdadmNeilBrown2009-12-305-49/+69
|\ | | | | | | | | Conflicts: super-intel.c
| * imsm: prune dead code in validate_geometry_imsmDan Williams2009-12-101-15/+0
| | | | | | | | Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * Fix required to enable RAID arrays on SAS disks.Artur Wojcik2009-12-103-10/+12
| | | | | | | | | | | | | | | | | | | | | | | | The patch increases the capacity of buffers used to store sysfs path names. Originally the buffers were too small to hold the canonical representation of sysfs path (in case of a SAS device, especially a device installed behind an expander). Signed-off-by: Artur Wojcik <artur.wojcik@intel.com> Reviewed-by: Andre Noll <maan@systemlinux.org> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * Fix for resource leak on error path.Artur Wojcik2009-12-101-3/+5
| | | | | | | | | | | | | | | | Make sure opened file descriptors are cleaned up in the exit path when error occured. Signed-off-by: Artur Wojcik <artur.wojcik@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * Fix for buffer overflow defect.Artur Wojcik2009-12-101-1/+1
| | | | | | | | | | | | | | | | Array index of 'path' may be out of bounds. Array 'path' of size 256 may use index value(s) 0..284. Signed-off-by: Artur Wojcik <artur.wojcik@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * Fix for buffer overflow error.Artur Wojcik2009-12-101-1/+1
| | | | | | | | | | | | | | | | Array index of 'device' may be out of bounds. Array 'device' of size 40 may use index value(s) 0..43. Signed-off-by: Artur Wojcik <artur.wojcik@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * Fix for memory leak defect.Artur Wojcik2009-12-101-0/+2
| | | | | | | | | | | | | | | | Possible memory leak. Dynamic memory stored in 'dev' and 'dev' allocated through function 'malloc' can be lost on exit path. Signed-off-by: Artur Wojcik <artur.wojcik@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * Fix for memory leak defect.Artur Wojcik2009-12-101-3/+5
| | | | | | | | | | | | | | | | | | Possible memory leak. Dynamic memory stored in 'sra' allocated through function 'sysfs_read' at line 2484 can be lost at lines 2491, 2560 and 2571. Signed-off-by: Artur Wojcik <artur.wojcik@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * Fix for memory leak defect.Artur Wojcik2009-12-101-3/+6
| | | | | | | | | | | | | | | | Dynamic memory stored in 'devnum2devname(st->container_dev)' allocated through function 'devnum2devname' at line 1274 is lost at line 1278. Signed-off-by: Artur Wojcik <artur.wojcik@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * Fix for NULL pointer dereference defect.Artur Wojcik2009-12-101-0/+6
| | | | | | | | | | | | | | | | Pointer 'c' returned from call to function 'strchr' at line 954 may be NULL and will be dereferenced at line 955. Signed-off-by: Artur Wojcik <artur.wojcik@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * Fix for NULL pointer dereference defect.Artur Wojcik2009-12-101-1/+1
| | | | | | | | | | | | | | | | Pointer 'disk' returned from call to function '_get_imsm_disk' at line 700 may be NULL and will be dereferenced at line 710. Signed-off-by: Artur Wojcik <artur.wojcik@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * Fix for NULL pointer dereference defect.Artur Wojcik2009-12-101-0/+2
| | | | | | | | | | | | | | | | Pointer 'st' returned from call to function 'malloc' at line 320 may be NULL and it will be dereferenced at line 321. Signed-off-by: Artur Wojcik <artur.wojcik@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * imsm: no need to report the component device name from container_contentDan Williams2009-12-101-2/+0
| | | | | | | | | | | | | | | | sysfs_add_disk() regenerates the name from major:minor, so we can drop a strcpy that the static analysis checker does not like. Reported-by: Artur Wojcik <artur.wojcik@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * Fix for buffer overflow defect.Artur Wojcik2009-12-101-1/+1
| | | | | | | | | | | | | | Buffer overflow, array index of 'nm' may be out of bounds. Signed-off-by: Artur Wojcik <artur.wojcik@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * Fix for NULL pointer dereference.Artur Wojcik2009-12-101-0/+4
| | | | | | | | | | | | | | | | | | Pointers '_dev' and '_disk' returned from call to function '_get_imsm_dev' and '_get_imsm_disk' may be NULL and will be dereferenced at lines 2933 and 2934, respectively. Signed-off-by: Artur Wojcik <artur.wojcik@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>