From: "Hervé Eychenne" <rv@eychenne.org>
To: linux-raid@vger.kernel.org
Subject: waiting for recovery to complete
Date: Wed, 13 Apr 2005 10:50:56 +0200 [thread overview]
Message-ID: <20050413085056.GP21278@eychenne.org> (raw)
Hi,
Suppose I'm waiting for a recovery to be completed, and want to run a
command afterwards (halt, send a mail, or anything else...).
The most practiacl way I can see is to check /proc/mdstat.
But what if I want to do that automatically (without bothering looking
at it manually from time to time)?
For example, one could do:
# while cat /proc/mdstat | grep recovery > /dev/null ; do sleep 5 ; done
But that's quite ugly, as:
- it's an active polling, and it is time consuming (even if slightly)
- it may even be unreliable, as I guess one cannot ensure that /proc/mdstat
will print the "recovery" string during the (very short, but well...)
transition between two partitions to recover
I think that a passive wait would be much better instead.
And ideally, we should have a simple and efficient way to let a program
know if a device is in a clean state (or being recovered), and another
that would wait until the device is clean (recovery finished).
So, the while loop could be replaced by something like
mdadm --recovery-wait (for example)
which would exit only when all pending recoveries have finished, and
let the script continue.
That would be much practical, reliable, and cleaner than a loop, don't you
think?
How this could be achieved is another question... probably the best
would be that userspace can select on a file descriptor, or something
like that (netlink device?)
What do you think?
Hervé
--
_
(°= Hervé Eychenne
//) Homepage: http://www.eychenne.org/
v_/_ WallFire project: http://www.wallfire.org/
-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next reply other threads:[~2005-04-13 8:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-13 8:50 Hervé Eychenne [this message]
2005-04-17 17:49 ` waiting for recovery to complete Tim Moore
2005-04-19 10:28 ` Hervé Eychenne
2005-04-19 11:16 ` David Greaves
[not found] ` <62b0912f05041905226bed8997@mail.gmail.com>
2005-04-19 12:22 ` Molle Bestefich
2005-04-19 12:27 ` Alvin Oga
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050413085056.GP21278@eychenne.org \
--to=rv@eychenne.org \
--cc=linux-raid@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).