summaryrefslogtreecommitdiff
path: root/mdstat.c
Commit message (Collapse)AuthorAge
* Grow: use mdstat_wait to wait for delayed reshape.NeilBrown2013-07-10
| | | | | | | | | | Having a fix time for a wait is clumsy and can make us wait much too long. So use mdstat_wait and keep the mdstat_fd open. This requires an 'mdstat_close' so it doesn't stay open forever. Signed-off-by: NeilBrown <neilb@suse.de>
* Discard devnum in favour of devnmNeilBrown2013-02-21
| | | | | | | | | | | | | | We widely use a "devnum" which is 0 or +ve for md%d devices and -ve for md_d%d devices. But I want to be able to use md_%s device names. So get rid of devnum (a number) and use devnm (a 32char string). eg. md0 md_d2 md_home Signed-off-by: NeilBrown <neilb@suse.de>
* Remove scattered checks for malloc success.NeilBrown2012-07-09
| | | | | | | | | | | | | | malloc should never fail, and if it does it is unlikely that anything else useful can be done. Best approach is to abort and let some super-daemon restart. So define xmalloc, xcalloc, xrealloc, xstrdup which don't fail but just print a message and exit. Then use those removing all the tests for failure. Also replace all "malloc;memset" sequences with 'xcalloc'. Signed-off-by: NeilBrown <neilb@suse.de>
* Introduce pr_err for printing error messages.NeilBrown2012-07-09
| | | | | | | 'pr_err("' is a lot shorter than 'fprintf(stderr, Name ": ' cont_err() is also available. Signed-off-by: NeilBrown <neilb@suse.de>
* Monitor: fix inconsistencies in values for ->percentNeilBrown2012-06-04
| | | | | | | | | | | | | ->percent sometimes stores negative values recording states like 'pending' or 'delayed'. The value '-2' means both 'delayed' and in Monitor, 'unknown'. Also, '-1' has a meaning but not #define. So change the #defines to be prefixed with "RESYNC_", instead of "PROCESS_", add new "_NONE" and "_UNKNOWN", and use correct value in each location. Signed-off-by: NeilBrown <neilb@suse.de>
* mdstat_read(): Check return value of dup() before using file descriptorJes Sorensen2011-11-03
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Show DELAYED, PENDING status of resync process in "--detail"Krzysztof Wojcik2011-06-23
| | | | | | | | | | | | | | | | Initially there is no proper translation mdstat's DELAYED/PENDING processes to "--detail" output. For example, if we have recover=DELAYED in mdstat, "--detail" shows "State: recovering" and "Rebuild Status = 0%". It was incorrect in case of process waiting on checkpoint different than 0%. In fact rebuild status is differnt than 0% and user is misled. The patch fix the problem. Current "--detail" command shows in the exampe: "State: recovering (DELAYED)" and no information about precentage. Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* FIX: Position calculation in mdstat_by_subdevKrzysztof Wojcik2011-01-06
| | | | | Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: Prepare reshape_update in mdadmNeilBrown2010-12-16
| | | | | | | | | | | | | | | | | | | | | | | | During Online Capacity Expansion metadata has to be updated to show array changes and allow for future assembly of array. To do this mdadm prepares and sends reshape_update metadata update to mdmon. The update contains the old and new number of raid disks, and the indices of the spare disks that will be used to fill the spaces. This works as follows: 1. reshape_super() prepares metadata update. 2. mdadm discovers the spares and adds them to the array 3. mdadm sends the update to mdmon 4. managemon in prepare_update() allocates required memory for bigger device object 5. monitor in process_update() updates the metadata to record the new sizes and the newly assigned devices. 6. mdadm initiates the reshape Based on code From: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com> Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* fix: mdstat_read() incorrectly translates value of mdstat_ent->reshape for ↵Hawrylewicz Czarnowski, Przemyslaw2010-12-09
| | | | | | | | | | recovering it results in wrong output of mdadm --detail (shows reshaping instead of recovering) Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* mdmon: don't copy an invalid chunk_sizeNeilBrown2010-11-30
| | | | | | | | | As chunk_size in mdstat_ent is never set, we shouldn't copy it into a->info.array. In fact, it is safest to get rid of the field altogether. Reported-by: "Kwolek, Adam" <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* detail/wait: better handling of monitoring sync action.NeilBrown2010-11-22
| | | | | | | Detail: report reshape and check as well as resync and recovery Wait: if the resync is pending or delayed, wait for that too. Signed-off-by: NeilBrown <neilb@suse.de>
* Fix the count of member devices in mdstat_read function.Marcin Labun2010-07-06
| | | | | | | | | | Correction of the number of container or volume member devices (devcnt in struct mdstat_ent). The number after the last devices was counted towards member of devices. Signed-off-by: Marcin Labun <marcin.labun@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Add mdstat_by_componentNeilBrown2010-06-30
| | | | | | | | | | | | | This allows finding the array which contains a given component. Components are named using the kernel-internal string name such as "sda1" or "hdb". Don't return member arrays, only the contain that contains them. Also tidy up the parsing of 'inactive' arrays in /proc/mdstat. If we see 'inactive' we need to set 'in_devs' immediately as there is no level coming. Signed-off-by: NeilBrown <neilb@suse.de>
* Fix parsing of inactive arrays in /proc/mdstatJeff DeFouw2010-06-29
| | | | | | | They don't have a level, so we should not expect one, and should expect devices instead. Signed-off-by: NeilBrown <neilb@suse.de>
* mdmon: don't monitor /proc/mounts to decide when to create .pid file.NeilBrown2010-02-08
| | | | | | | | | | | 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: allow pid to be stored in different directory.NeilBrown2010-02-04
| | | | | | | | /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>
* Update copyright dates and remove references to @cse.unsw.edu.auNeilBrown2009-06-02
| | | | | | Also removed 'paper' addresses. Signed-off-by: NeilBrown <neilb@suse.de>
* Wait for POLLPRI on /proc or /sys files.NeilBrown2009-04-14
| | | | | | | | | | | | | 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>
* mdmon: recreate socket/pid file on SIGHUPDan Williams2008-09-15
| | | | | | | | | | Allow mdmon to start while /var/run/mdadm is readonly. Later a SIGHUP can trigger mdmon to drop its pid and socket once /var/run/mdadm is writable. Of course one needs the pid to send a HUP, that can be stored in a distribution specific rw-init directory... For now, rely on a killall -HUP mdmon to get the files dumped. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Fix mdstat_wait_fdNeilBrown2008-08-19
| | | | | | It didn't necessarily wait for the fd. Signed-off-by: NeilBrown <neilb@suse.de>
* Introduce devname2devnumNeil Brown2008-07-12
| | | | and use it instead of opencoding.
* Remove stopped arrays.Neil Brown2008-05-27
| | | | | | When an array becomes inactive, clean up and forget it. This involves signalling the manager.
* close some memory leaksDan Williams2008-05-15
| | | | | | From: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Merge mdmonNeil Brown2008-05-15
|
* Remove spaces/tabs from ends of lines.Neil Brown2007-12-14
|
* Mark some files FD_CLOEXEC to protect sendmail from them.Doug Ledford2007-07-09
| | | | | | | | | | | 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.
* Add new mode: --incrementalNeil Brown2006-12-21
| | | | | --incremental allows arrays to be assembled one device at a time. This is expected to be used with udev.
* Minor man page and comment fixesNeil Brown2006-10-09
| | | | Thanks To: "Scott Weikart" <Scott.W@Benetech.org>
* Just updaqte copyright dates and email addressNeil Brown2006-05-19
| | | | Signed-off-by: Neil Brown <neilb@suse.de>
* Sort mdstat entries so that composites are well-ordered.Neil Brown2006-01-31
| | | | | | | This means that "-Ds" lists arrays in an approprate order for assembly. Signed-off-by: Neil Brown <neilb@suse.de>
* mdadm-1.7.0Neil Brown2004-08-11
|
* mdadm-1.6.0Neil Brown2004-06-04
|
* mdadm-1.5.0Neil Brown2004-01-22
|
* mdadm-0.8Neil Brown2002-04-04