summaryrefslogtreecommitdiffstats
path: root/mdmon.c
Commit message (Collapse)AuthorAgeFilesLines
* mdmon: update cmdline when scanningDan Williams2009-02-241-0/+7
| | | | | | | | | | | | Allows ps -ax | grep mdmon to show: mdmon md127 mdmon md126 ...rather than: mdmon /proc/mdstat mdmon /proc/mdstat Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* mdmon: fix removed disk handlingDan Williams2009-02-241-1/+1
| | | | | | | | Use SKIP_GONE_DEVS when reading the container, and correct some confused logic in manage_new(). Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* mdmon: make switchroot an undecorated optionDan Williams2009-01-201-9/+5
| | | | | | | | | | Simplify the usage from: mdmon [--switch-root dir] /device/name/for/container to... mdmon /device/name/for/container [target_dir] Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* mdmon: support scanning for containersDan Williams2009-01-201-22/+49
| | | | | | | | When the given container is '/proc/mdstat' then launch an mdmon instance per container found in /proc/mdstat. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* mdmon: expand permissible container device namesDan Williams2009-01-201-3/+18
| | | | | | | | Allow any path that dereferences to an md device to be used in addition to the current symbolic md device names. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* mdmon: fix missing ->subarray initializationDan Williams2009-01-131-0/+1
| | | | | | This can cause mdmon to fail at startup. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* mdmon: pass symbolic name to mdmon instead of device name.NeilBrown2008-11-201-4/+13
| | | | | | | | | | | | | Now that names in /dev are usually created (eventually) by udev, it isn't really safe to rely in finding a name in /dev to pass to mdmon to identify which array to monitor. And it isn't really necessary to have a name in /dev. So just pass the symbolic name, e.g. md127 or md123. Change util.c to pass that name, and change mdmon to process the name sensibly. Signed-off-by: NeilBrown <neilb@suse.de>
* A couple of bugfixes found by suse autobuilding:NeilBrown2008-11-071-1/+13
| | | | | | | 1/ ia64 appear to have __clone2, not clone. 2/ Including "++" in the arg to a macro is a bad thing to do. Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble: revert preliminary -As supportDan Williams2008-11-041-0/+9
| | | | | | I have seen the light. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* 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>
* Preliminary -As support for container member arraysDan Williams2008-10-281-9/+0
| | | | | | | | | | | | 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>
* update copyright headersDan Williams2008-10-281-0/+19
| | | | Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* mdmon: suicide preventionDan Williams2008-10-151-0/+4
| | | | | | | | | | mdmon cannot remove the pidfile at shutdown becuase it needs to stay running across the "mount -o remount,ro /" event. When it relaunches after a reboot there is a good chance that the pid will match what was there previously. The result is that the "take over for unresponsive mdmon" logic results in self termination. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* quiet WaitClean()Dan Williams2008-10-151-1/+1
| | | | Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* mdmon: --switch-rootDan Williams2008-10-151-55/+94
| | | | | | | | | | | | | | | | | | | For raid rootfs we cannot run the array unmonitored for any length of time. At least XFS will not mount/replay the journal if the underlying block device is readonly (FIXME it also seems that XFS does not always honor the ro status of the backing device as I was able to hit the BUG_ON(mddev->ro == 1) in md_write_start... but I digress). So we need to start mdmon in the initramfs before '/' is mounted and then restart it after the real rootfs is available. Upon seeing the --switch-root option, mdmon will kill any victims in the current /var/run/mdadm directory and then chroot(2) before continuing. The option is deliberately called 'switch-root' instead of 'chroot' to hopefully indicate that this is different than doing "chroot mdmon /dev/imsm". Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* mdmon: wait after trying to killDan Williams2008-10-151-22/+47
| | | | | | | | | | | | Now that mdmon handles sigterm if another monitor wants to take over it should wait until all managed arrays are clean. So make WaitClean() available to mdmon and teach try_kill_monitor() to wait on each subarray in the container. ...since we may be communicating with a dieing process, we need to block SIGPIPE earlier. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* mdmon: terminate cleanDan Williams2008-10-151-0/+19
| | | | | | | | | | | We generally don't want mdmon to be terminated, but if a SIGTERM gets through try to leave the monitored arrays in a clean state, block attempts to mark the array dirty, and stop servicing the socket. When we are killed by sigterm don't remove the pidfile let that be cleaned up by the next monitor. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* mdmon: periodically retry to create the socketDan Williams2008-10-151-2/+2
| | | | | | | | If initial socket creation fails, EROFS, set a periodic alarm to wake up the manager and retry. Include a kernel patch that will wake us up if the mount flags are changed. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* trivial warn_unused_result squashingDan Williams2008-10-151-6/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Made the mistake of recompiling the F9 mdadm rpm which has a patch to remove -Werror and add "-Wp,-D_FORTIFY_SOURCE -O2" which turns on lots of errors: config.c:568: warning: ignoring return value of asprintf Assemble.c:411: warning: ignoring return value of asprintf Assemble.c:413: warning: ignoring return value of asprintf super0.c:549: warning: ignoring return value of posix_memalign super0.c:742: warning: ignoring return value of posix_memalign super0.c:812: warning: ignoring return value of posix_memalign super1.c:692: warning: ignoring return value of posix_memalign super1.c:1039: warning: ignoring return value of posix_memalign super1.c:1155: warning: ignoring return value of posix_memalign super-ddf.c:508: warning: ignoring return value of posix_memalign super-ddf.c:645: warning: ignoring return value of posix_memalign super-ddf.c:696: warning: ignoring return value of posix_memalign super-ddf.c:715: warning: ignoring return value of posix_memalign super-ddf.c:1476: warning: ignoring return value of posix_memalign super-ddf.c:1603: warning: ignoring return value of posix_memalign super-ddf.c:1614: warning: ignoring return value of posix_memalign super-ddf.c:1842: warning: ignoring return value of posix_memalign super-ddf.c:2013: warning: ignoring return value of posix_memalign super-ddf.c:2140: warning: ignoring return value of write super-ddf.c:2143: warning: ignoring return value of write super-ddf.c:2147: warning: ignoring return value of write super-ddf.c:2150: warning: ignoring return value of write super-ddf.c:2162: warning: ignoring return value of write super-ddf.c:2169: warning: ignoring return value of write super-ddf.c:2172: warning: ignoring return value of write super-ddf.c:2176: warning: ignoring return value of write super-ddf.c:2181: warning: ignoring return value of write super-ddf.c:2686: warning: ignoring return value of posix_memalign super-ddf.c:2690: warning: ignoring return value of write super-ddf.c:3070: warning: ignoring return value of posix_memalign super-ddf.c:3254: warning: ignoring return value of posix_memalign bitmap.c:128: warning: ignoring return value of posix_memalign mdmon.c:94: warning: ignoring return value of write mdmon.c:221: warning: ignoring return value of pipe mdmon.c:327: warning: ignoring return value of write mdmon.c:330: warning: ignoring return value of chdir mdmon.c:335: warning: ignoring return value of dup monitor.c:415: warning: rv may be used uninitialized in this function ...some of these like the write() ones are not so trivial so save those fixes for the next patch. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Remove .sock file when removing .pid file for mdmonNeilBrown2008-09-181-0/+2
|
* mdmon: recreate socket/pid file on SIGHUPDan Williams2008-09-151-9/+26
| | | | | | | | | | 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>
* mdmon: remove devices from containerDan Williams2008-08-191-1/+1
| | | | | | | | Once the monitor thread has kicked a drive from all managed arrays mdadm -r is permitted. We are guaranteed that the drive is marked failed at this point, so allow the drive to be re-added as a spare. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* mdmon: don't fork if DEBUGDan Williams2008-07-241-16/+32
|
* mdmon: fork and run as a daemon.NeilBrown2008-07-181-0/+38
| | | | | | | start_mdmon now waits for mdmon to complete initialisation and, importantly, listen on the socket, before continuing. Signed-off-by: Neil Brown <neilb@suse.de>
* mdmon: close small window of invalid mon_tidDan Williams2008-07-141-6/+3
| | | | | | | There is a small chance that the manager tries to wake the monitor before mon_tid is set. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Keep container device open in monitorNeil Brown2008-07-121-2/+0
| | | | | ... so that it cannot be stopped while there are active arrays. I don't know where that second 'close' came from ....
* Revise message passing code.Neil Brown2008-07-121-1/+6
| | | | More here
* Remove mgr_pipe for communicating from manage to monitor.Neil Brown2008-07-121-17/+22
| | | | | 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-6/+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.
* imsm: reenable mdmonDan Williams2008-06-161-0/+2
| | | | Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Exit when there are no more arrays to manage.Neil Brown2008-05-271-1/+10
|
* Remove supertype->devfdNeil Brown2008-05-271-1/+1
| | | | It is never used.
* Remove stopped arrays.Neil Brown2008-05-271-0/+6
| | | | | | When an array becomes inactive, clean up and forget it. This involves signalling the manager.
* Discard 'array_list' in mdmonNeil Brown2008-05-271-1/+0
| | | | The container has an ->arrays field that we should be using.
* add infrastructure to receive higher order commands, like remove_deviceDan Williams2008-05-151-7/+19
| | | | | | | | | | | From: Dan Williams <dan.j.williams@intel.com> Each md_message encapsulates a single command. A command includes an 'action' member which describes what if any data comes after the action. Communication with the monitor involves updating the active_cmd pointer and then writing to mgr_pipe. Pass/fail status is returned via mon_pipe. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* start fleshing out socket code, ping monitor to see if it is aliveDan Williams2008-05-151-6/+51
| | | | | | From: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Merge mdmonNeil Brown2008-05-151-0/+222