Commit Graph

87 Commits

Author SHA1 Message Date
Dan Williams 4065aa816a monitor: clean up some debug messages
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-09-15 20:58:43 -07:00
Dan Williams 1770662bca 'mdadm --wait-clean' wait for array to be marked clean
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>
2008-09-15 20:58:42 -07:00
Dan Williams 0c0c44db5a monitor: don't mark dirty on resync complete
...instead look at array state to determine if the array is consistent

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-09-15 20:58:42 -07:00
Dan Williams d797a0621f monitor: mark clean on active-idle
This also handles the case where 'clean' is set directly.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-09-15 20:58:42 -07:00
NeilBrown e9dd159873 Allow an externally managed array to be marked readonly
If the metadata_version is
    -mdXXX/whatever
rather than
    /mdXXX/whatever

then the array is readonly and should be left alone by mdmon.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-08-19 17:55:15 +10:00
NeilBrown 01f157d74a Extra option for set_array_state: you choose dirty or clean.
When we first start an array, it might be good to start recovery
straight away.  That requires setting the array to 'dirty', but
only the metadata handler can know if that is required or not.
So have a third possible 'consistent' option to set_array_state.
Either 'no' or 'yes' or 'you choose'.

Return value indicates what was chosen.

'1' (no) should be chosen unless there is a good reason.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-08-19 14:54:55 +10:00
Dan Williams 9296754385 mdmon: handle failures versus readauto arrays
Transition readauto arrays to active before failing drives.

Hmm... why do we keep reblocking / renotifying in the readonly case?
Need to bottom out on this, but not right now.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-08-15 10:58:43 -07:00
Dan Williams 272906ef49 mdmon: use activate spare for re-add
Disks that are not in-sync or failed are not assembled into member
arrays by mdadm.  Teach mdmon to resolve this situation by checking for
spares at start.  imsm_activate_spare() is updated to prefer devices
that can be re-added versus new spares.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-08-12 02:25:46 -07:00
Dan Williams 5802a8118e imsm: handle degraded->normal transitions in set_disk
Removes the need for the call to ->set_array_state when sync_action
transitions from 'recover' to 'idle'.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-07-24 17:26:23 -07:00
NeilBrown 33af8567de monitor: call get_resync_start on array shutdown.
If the array is shutdown as soon as resync finishes, we might not
notice the resync finish.  So on array shutdown, check for current
resync pos.

Signed-off-by: Neil Brown <neilb@suse.de>
2008-07-18 16:37:26 +10:00
NeilBrown 1eb252b848 mdmon: ping will wait for manage_mon to catch up.
When a 'ping' (empty message) is sent to mdmon, we wait for
'monitor' to do a full loop to make sure it has caught up
with anything that needs doing.
This allows synchronisation between mdadm and mdmon.

Maybe monitor should signal managemon rather than managemon polling...

Signed-off-by: Neil Brown <neilb@suse.de>
2008-07-18 16:37:06 +10:00
Neil Brown 103f2410ec Make sure resync_start is initialised properly and maintained properly
Signed-off-by: Neil Brown <neilb@suse.de>
2008-07-18 16:37:04 +10:00
Dan Williams 00e021427e mdmon: close possibility of re-marking the metadata dirty on shutdown
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-07-14 14:59:39 -07:00
Dan Williams 0a6bdbee8d mdmon: notify metadata of recovery completion
Array may no longer be degraded.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-07-14 14:59:39 -07:00
Neil Brown 207aac36d5 Make sure we remove pid file in monitor before manager exits. 2008-07-12 20:27:42 +10:00
Neil Brown a35c070bcd Remove some noisy printfs. 2008-07-12 20:27:41 +10:00
Neil Brown bfa44e2e7a Revise message passing code.
More here
2008-07-12 20:27:40 +10:00
Neil Brown 4d43913ce0 Remove mgr_pipe for communicating from manage to monitor.
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.
2008-07-12 20:27:40 +10:00
Neil Brown 2f64e61a50 Remove mon_pipe for communicating from monitor to manager
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.
2008-07-12 20:27:40 +10:00
Neil Brown f94d52f43e Handle device removal from container
This really should be done in mdadm, not mdmon.
We ensure the device won't be suddenly commited as a hot-spare
using O_EXCL, then check the 'holders' sysfs directory
to make sure it is only in use once.
2008-07-12 20:27:40 +10:00
Dan Williams 4e6e574a3e mdmon: add debug print statements for profiling mdmon
for development only as console output can block leading to monitor deadlocks
in low mem situations

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-06-16 15:50:07 -07:00
Neil Brown 7e1432fb14 Add DDF code for activate_spare
Plus various bug fixes etc.
2008-06-12 10:13:32 +10:00
Neil Brown 6c3fb95c44 Support adding a spare to a degraded array.
When signalled by the monitor, the manager will find spares and
add them to the array and initiate a recovery.
2008-06-12 10:13:29 +10:00
Neil Brown 57632f4afb Some fixes to make failures in ddf get handled properly. 2008-06-12 10:13:28 +10:00
Neil Brown 2e735d1982 Allow passing metadata update to the monitor.
Code in manager can now just call queue_metadata_update with a
(freeable) buf holding the update, and it will get passed to the
monitor and written out.
2008-06-12 10:13:23 +10:00
Neil Brown ed9d66aade Change mark_clean to set_array_state.
DDF needs more fine grained understanding of the array state.
2008-05-27 09:18:54 +10:00
Neil Brown 77402e5105 Discard get_sync_pos. We should be using get_resync_start.
"sync_complete" just tracks the current resync/recover/check/whatever pass.
"resync_start" tracks which parts of the array are known to be in-sync
(modulo active writes).  So it is what we need to use to update the metadata.
Also we cannot call it when the array has stopped, as the value is no longer
available then.  We must call it when the resync completes.
Possibly also call it preiodically if the array is quiescent.
2008-05-27 09:18:53 +10:00
Neil Brown e0d6609fe6 Exit when there are no more arrays to manage. 2008-05-27 09:18:41 +10:00
Neil Brown 1ed3f38758 Remove stopped arrays.
When an array becomes inactive, clean up and forget it.

This involves signalling the manager.
2008-05-27 09:18:39 +10:00
Neil Brown 4e5528c6f7 Implement mark_clean for ddf and remove mark_dirty and mark_sync
mark_dirty is just a special case of mark_clean - with sync_pos == 0.
mark_sync is not required.  We don't modify the metadata when sync
finishes.  Only when the array becomes non-writeable at which point we
use mark_clean to record how far the resync progressed.
2008-05-27 09:18:38 +10:00
Dan Williams 3e70c845e2 add infrastructure to receive higher order commands, like remove_device
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>
2008-05-15 16:48:54 +10:00
Dan Williams 0af73f61a2 when failures happen they should be propagated to all member arrays
From: Dan Williams <dan.j.williams@intel.com>

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-05-15 16:48:51 +10:00
Dan Williams 8d45d1969b handle disk failures
From: Dan Williams <dan.j.williams@intel.com>

Added curr_state as a parameter to set_disk.  Handlers look at this to
record components failures, and set global 'degraded' or 'failed'
status.

When reading the state as faulty:
1/ mark the disk failed in the metadata

2/ write '-blocked' to the rdev state to allow the kernel's failure
   mechanism to advance

3/ the kernel will take away the drive's role in remove_and_add_spares()

4/ once the disk no longer has a role writing 'remove' to the rdev state
   will get the disk out of array.

There is a window after writing '-blocked' where the kernel will return
-EBUSY to remove requests.  We rely on the fact that the disk will
continue to show faulty so we lazily wait until the kernel is ready to
remove the disk.  If the manager thread needs to get the disk out of the
way it can ping the monitor and wait, just like the replace_array()
case.

[buglet fix: swap the parameters of attr_match in read_dev_state]

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-05-15 16:48:49 +10:00
Dan Williams 2a0bb19e00 Flag arrays for deletion after they have been stopped.
From: Dan Williams <dan.j.williams@intel.com>

If they are later reassembled they will be replaced and deallocated
via replace_array.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-05-15 16:48:44 +10:00
Dan Williams fd7cde1bf0 handle resync completion
From: Dan Williams <dan.j.williams@intel.com>

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-05-15 16:48:42 +10:00
Dan Williams c052ba301b start resync when transitioning from initial readonly state
From: Dan Williams <dan.j.williams@intel.com>

mdadm handles setting resync_start, monitor uses this value to determine
whether to set the 'active' or 'readauto' state.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-05-15 16:48:39 +10:00
Neil Brown 549e9569c6 Merge mdmon 2008-05-15 16:48:37 +10:00