summaryrefslogtreecommitdiffstats
path: root/Monitor.c
Commit message (Collapse)AuthorAgeFilesLines
* config: allow Array line to contain array name without /dev/md/ prefix.NeilBrown2009-05-111-1/+7
| | | | | | | | | | | | | | | For consistency with --create and --assemble, allow the array name given in mdadm.conf to exclude the "/dev/md/" prefix. So e.g. ARRAY home uuid=whatever is treated like ARRAY /dev/md/home uuid=whatever Also exclude names which create_mddev will reject. Signed-off-by: NeilBrown <neilb@suse.de>
* config: support "ARRAY <ignore> ..." lines in mdadm.confNeilBrown2009-05-111-0/+2
| | | | | | | | | | | | | | Sometimes we want to ensure particular arrays are never assembled automatically. This might include an array made of devices that are shared between hosts. To support this, allow ARRAY lines in mdadm.conf to use the word "ignore" rather than a device name. Arrays which match such lines are never automatically assembled (though they can still be assembled by explicitly giving identification information on the mdadm command line. Signed-off-by: NeilBrown <neilb@suse.de>
* Wait for POLLPRI on /proc or /sys files.NeilBrown2009-04-141-1/+1
| | | | | | | | | | | | | From 2.6.30, /proc/mounts and various /sys files will probably always returns 'readable' to select, so we will need to wait on POLLPRI to get the 'new data is available' signal. When using select, this corresponds to an 'exception', so adjust calls to select accordingly. In one case we sometimes wait on a socket and sometime on /proc/mounts, so we need to test which. Signed-off-by: NeilBrown <neilb@suse.de>
* Merge branch 'master' in devel-3.0NeilBrown2009-03-101-0/+2
|\
| * Monitor: send --test message for arrays in /proc/mdstat that aren't in ↵NeilBrown2009-02-051-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | mdadm.conf "mdadm --monitor --test --scan" currently only sends test messages for arrays listed on the command line or in /etc/mdadm.conf. With this patch it also reports on any active arrays, which is more in line with the description in the manpage. Thanks to Andrew Walrond <andrew@walrond.org> for reporting this error. Signed-off-by: NeilBrown <neilb@suse.de>
* | Merge branch 'master' into scratch-3.0NeilBrown2009-01-081-1/+1
|\| | | | | | | | | | | | | Conflicts: Assemble.c config.c
| * Free mdstat data structures properly.NeilBrown2009-01-081-1/+1
| | | | | | | | | | | | | | In one case we called 'free' instead of 'mdstat_free'. In others we didn't free at all. Signed-off-by: NeilBrown <neilb@suse.de>
* | fix ->metadata_version checking in Wait()Dan Williams2008-12-021-1/+1
| | | | | | | | Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | config: Don't require an array to have a device name.NeilBrown2008-11-041-1/+4
| | | | | | | | | | | | | | | | | | | | i.e. in mdadm.conf you can have a line like ARRAY uuid=whatever and it will use auto-name-generation to give a name to the array at assemble-time. The is different from blind auto-assembly in that the array will be treated as 'local'.
* | quiet WaitClean()Dan Williams2008-10-151-5/+7
| | | | | | | | Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Extend --wait-clean to checkpoint resyncDan Williams2008-10-151-0/+3
| | | | | | | | | | | | | | | | | | Root file systems backed by external metadata arrays need to be explicitly checkpointed near the time the rootfs is marked readonly as userspace will not have an opportunity to react to the final shutdown of the array. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | --wait-clean: shorten timeoutDan Williams2008-10-151-12/+23
| | | | | | | | | | | | | | | | | | | | | | | | Set the safemode timeout to a small value to get the array marked clean as soon as possible. We don't write 'clean' directly as it may cause mdmon to miss a 'write-pending' event. Include a couple fixes to sysfs_set_safemode(): 1/ 0 pad the milliseconds field 2/ workaround input truncation in the kernel Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | 'mdadm --wait-clean' wait for array to be marked cleanDan Williams2008-09-151-0/+88
| | | | | | | | | | | | | | | | | | 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-4/+8
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Clean up usage of open()Doug Ledford2008-07-241-1/+1
| | | | | | | | Fix on call that passed an invalid mode to open Don't pass a third arg unless we also pass O_CREAT Use symbolic args for 2nd and 3rd args Signed-off-by: Doug Ledford <dledford@redhat.com>
* Fix for segfault when reading /proc/mdstatNeil Brown2008-04-281-0/+1
| | | | | | | | | Some kernel versions don't put a space between 'active' and '(auto-read-only)' in /proc/mdstat. This causes a parsing problem leaving 'level' set to NULL which causes a crash. So synthesise a space there if it is missing, and check for 'level' to be NULL and don't de-ref if it is.
* Replace sysarray with mdinfoNeil Brown2007-12-141-1/+1
| | | | | Sure, mdinfo is bigger, but having a uniform structure for lots of things will make life easier.
* Remove spaces/tabs from ends of lines.Neil Brown2007-12-141-9/+9
|
* Monitor.c s/MAXINT/INT_MAX/gmaximilian attems2007-09-271-6/+6
| | | | | | | include limits.h directly instead of values.h Signed-off-by: maximilian attems <max@stro.at> Signed-off-by: Neil Brown <neilb@suse.de>
* Monitor.c include signal.h directlymaximilian attems2007-09-271-1/+1
| | | | | | | another small step for better klibc support, glibc compile tested. Signed-off-by: maximilian attems <max@stro.at> Signed-off-by: Neil Brown <neilb@suse.de>
* Enhance raid4 support: --assemble and --monitor wasn't quite happy with it.Doug Ledford2007-07-091-5/+6
| | | | | | | | | | | | | | | | | | | | | | | From: Doug Ledford <dledford@redhat.com> This one actually does a couple things. Mainly related to raid4, but kinda touches other raid levels some. When creating a raid4 array, treat it like a raid5 array in that we create it in degraded mode by default and add the last disk as a spare. Besides speeding things up, this has a second effect that it makes mdadm more consistent. In order to create a degraded raid5 array, you need only passing missing as one of the devices. For a degraded raid4 array, prior to this patch, you must pass assume-clean or else it refuses to create the array. Even force won't make it work without assume-clean. With the patch, raid4 behaves identical to raid5. Separate from that, the monitor functionality completely ignores raid4 arrays. That seems to stem from the code that checks to see if the array is part of a long list of types. It seems easier to check which array types *aren't* redundant instead of listing the ones that are redundant and missing some of them. This makes the monitor service actually watch raid4 arrays.
* Mark some files FD_CLOEXEC to protect sendmail from them.Doug Ledford2007-07-091-0/+1
| | | | | | | | | | | From: Doug Ledford <dledford@redhat.com> When running with SELinux enabled and using mdadm to monitor devices, attempts to send emails to an admin will be blocked because mdadm is holding open /proc/mdstat without setting the FD_CLOEXEC flag. As a result, sendmail has an open descriptor to /proc/mdstat after the popen() call, which SELinux decides isn't really any of sendmail's business and so sendmail gets denied.
* Fix spare migration and other problems with --monitor.Neil Brown2007-07-091-0/+1
| | | | | 2.6 broke --monitor in various ways, including spare migration stopped working. This fixes it.
* Fix a bug that was causing incorrect warning from --monitor.Neil Brown2007-02-221-1/+1
|
* Release 2.6mdadm-2.6Neil Brown2006-12-211-1/+1
|
* Add new mode: --incrementalNeil Brown2006-12-211-1/+1
| | | | | --incremental allows arrays to be assembled one device at a time. This is expected to be used with udev.
* Don't hold md device open for so long in --monitor modeNeil Brown2006-12-141-4/+20
| | | | map_dev can be slow and interferes with trying to stop the array.
* When resync finished, report the mismatch count if there is one.Neil Brown2006-12-141-3/+19
| | | | | This doesn't get mailed out, but will appear in syslog... Maybe it should be mailed if it was a 'check' or 'repair' pass...
* --wait or -W will wait for resync activity to finish on the given devices.Neil Brown2006-12-141-0/+35
|
* More consistent honoring of --configfileNeil Brown2006-06-261-6/+6
| | | | | Never use /etc/mdadm.conf if --config file is given (previously some code used one, some used the other).
* Fix user-after-free bug in error path in --monitor mode.Neil Brown2006-06-261-1/+1
|
* Fix typo in mail message from --monitorNeil Brown2006-06-021-1/+1
| | | | | | From: martin f krafft <madduck@madduck.net> Signed-off-by: Neil Brown <neilb@suse.de>
* check return status of all write/fwrite functions as required by glibc 2.4Neil Brown2006-05-291-1/+1
| | | | | | | | | | | | From: Luca Berra <bluca@vodka.it> glibc 2.4 is pedantic on ignoring return values from fprintf, fwrite and write, so now we check the rval and actually do something with it. in the Grow.c case i only print a warning, since i don't think we can do anything in case we fail invalidating those superblocks (is should never happen, but then...) Signed-off-by: Neil Brown <neilb@suse.de>
* Choose better devnumbers and tidy up some issues with finding names.Neil Brown2006-05-261-0/+1
| | | | Signed-off-by: Neil Brown <neilb@suse.de>
* Just updaqte copyright dates and email addressNeil Brown2006-05-191-1/+1
| | | | Signed-off-by: Neil Brown <neilb@suse.de>
* Add a copy of /proc/mdstat to the mail message send by mdadm --monitor.Neil Brown2006-05-191-0/+11
| | | | Signed-off-by: Neil Brown <neilb@suse.de>
* Arrange that SparesMissing events generate an email too.Neil Brown2006-05-151-1/+3
| | | | Signed-off-by: Neil Brown <neilb@suse.de>
* Support 'mailfrom' line in mdadm.conf so the From: line in alert emails can ↵Neil Brown2006-05-151-18/+24
| | | | | | be explicitly set. Signed-off-by: Neil Brown <neilb@suse.de>
* Reduce dependance on MD_SB_DISKSNeil Brown2006-03-281-7/+17
| | | | | | --monitor should now work with arrays larger than 28 devices. Signed-off-by: Neil Brown <neilb@suse.de>
* Create missing /dev files where needed.Neil Brown2006-03-281-2/+2
| | | | | | | Whenever we need a device file to open, if one cannot be found in /dev, create a temporary one. Signed-off-by: Neil Brown <neilb@suse.de>
* Sort mdstat entries so that composites are well-ordered.Neil Brown2006-01-311-1/+1
| | | | | | | This means that "-Ds" lists arrays in an approprate order for assembly. Signed-off-by: Neil Brown <neilb@suse.de>
* syslog support for monitor modeNeil Brown2005-12-051-18/+45
| | | | | | | | | | | | From: ross@jose.lug.udel.edu (Ross Vandegrift) Hi Neil, While adding the text message mode, I saw a FIXME asking for syslog support in monitor mode. This patch adds exactly that. Signed-off-by: Neil Brown <neilb@suse.de>
* Report which device failed in a Fail message.Neil Brown2005-12-051-0/+3
| | | | Signed-off-by: Neil Brown <neilb@suse.de>
* Change MAJOR() etc to major() etcNeil Brown2005-04-041-5/+5
| | | | | | | | | This allows for larger device number if glibc supports it (requires 2.3.3). Also fail before creating larger device number if glibc support isn't present. Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
* mdadm-1.8.0mdadm-1.8.0Neil Brown2004-11-011-2/+15
|
* mdadm-1.7.0mdadm-1.7.0Neil Brown2004-08-111-1/+8
|
* mdadm-1.6.0mdadm-1.6.0Neil Brown2004-06-041-7/+10
|
* mdadm-1.5.0mdadm-1.5.0Neil Brown2004-01-221-15/+38
|
* mdadm-1.4.0mdadm-1.4.0Neil Brown2003-10-281-0/+7
|
* mdadm-1.3.0mdadm-1.3.0Neil Brown2003-07-281-4/+18
|