diff options
author | NeilBrown <neilb@suse.de> | 2008-07-18 16:37:06 +1000 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2008-07-18 16:37:06 +1000 |
commit | 1eb252b8488bbdd62ad602561fe8a90ef9079271 (patch) | |
tree | e5281b6756936f74ea4cde5dbb835063f1e6a3ba /managemon.c | |
parent | 103f2410ec581620367d6fde67a3a62f077062a7 (diff) | |
download | mdadm-1eb252b8488bbdd62ad602561fe8a90ef9079271.tar.gz |
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>
Diffstat (limited to 'managemon.c')
-rw-r--r-- | managemon.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/managemon.c b/managemon.c index 447d8ea..c947552 100644 --- a/managemon.c +++ b/managemon.c @@ -436,7 +436,15 @@ static void handle_message(struct supertype *container, struct metadata_update * struct metadata_update *mu; if (msg->len == 0) { + int cnt = monitor_loop_cnt; + if (cnt & 1) + cnt += 2; /* wait until next pselect */ + else + cnt += 3; /* wait for 2 pselects */ + wakeup_monitor(); wait_update_handled(); + while (monitor_loop_cnt - cnt < 0) + usleep(10 * 1000); } else { mu = malloc(sizeof(*mu)); mu->len = msg->len; |