From: NeilBrown <neilb@suse.de>
To: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
Cc: linux-raid@vger.kernel.org, wojciech.neubauer@intel.com,
adam.kwolek@intel.com, dan.j.williams@intel.com,
ed.ciechanowski@intel.com
Subject: Re: [PATCH] Retry writing 'inactive' state during stopping array
Date: Fri, 18 Mar 2011 12:43:15 +1100 [thread overview]
Message-ID: <20110318124315.14ac9813@notabene.brown> (raw)
In-Reply-To: <20110317163457.5322.18237.stgit@gklab-128-111.igk.intel.com>
On Thu, 17 Mar 2011 17:34:57 +0100 Krzysztof Wojcik
<krzysztof.wojcik@intel.com> wrote:
> Issue observed:
> Sporadicaly stopping arrays using "mdadm -Ss" command does not succeded.
> Cause:
> Writting "inactive" to the array state not succeded- array is busy
> (accessed by udev, blkid etc.)
> Resolution:
> If writing 'inactive' fails, wait and retry again (because it is possibly
> a transient failure)
>
> Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
Thanks. Applied,
though with a small change so that it will print an error message even if the
error isn't EBUSY.
Thanks,
NeilBrown
> ---
> Manage.c | 23 ++++++++++++++++-------
> 1 files changed, 16 insertions(+), 7 deletions(-)
>
> diff --git a/Manage.c b/Manage.c
> index ed3112e..a6531f3 100644
> --- a/Manage.c
> +++ b/Manage.c
> @@ -224,7 +224,9 @@ int Manage_runstop(char *devname, int fd, int runstop, int quiet)
> close(fd);
> fprintf(stderr,
> Name ": Cannot get exclusive access to %s:"
> - " possibly it is still in use.\n",
> + "Perhaps a running "
> + "process, mounted filesystem "
> + "or active volume group?\n",
> devname);
> return 1;
> }
> @@ -234,12 +236,18 @@ int Manage_runstop(char *devname, int fd, int runstop, int quiet)
> is_subarray(mdi->text_version)) {
> /* This is mdmon managed. */
> close(fd);
> - if (sysfs_set_str(mdi, NULL,
> - "array_state", "inactive") < 0) {
> - if (quiet == 0)
> - fprintf(stderr, Name
> - ": failed to stop array %s: %s\n",
> - devname, strerror(errno));
> +
> + count = 25;
> + while (count && sysfs_set_str(mdi, NULL,
> + "array_state", "inactive") < 0
> + && errno == EBUSY) {
> + usleep(200000);
> + count--;
> + }
> + if (!count && !quiet) {
> + fprintf(stderr, Name
> + ": failed to stop array %s: %s\n",
> + devname, strerror(errno));
> return 1;
> }
>
> @@ -297,6 +305,7 @@ int Manage_runstop(char *devname, int fd, int runstop, int quiet)
> usleep(200000);
> count --;
> }
> +
> if (fd >= 0 && err) {
> if (quiet == 0) {
> fprintf(stderr, Name
prev parent reply other threads:[~2011-03-18 1:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-17 16:34 [PATCH] Retry writing 'inactive' state during stopping array Krzysztof Wojcik
2011-03-18 1:43 ` NeilBrown [this message]
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=20110318124315.14ac9813@notabene.brown \
--to=neilb@suse.de \
--cc=adam.kwolek@intel.com \
--cc=dan.j.williams@intel.com \
--cc=ed.ciechanowski@intel.com \
--cc=krzysztof.wojcik@intel.com \
--cc=linux-raid@vger.kernel.org \
--cc=wojciech.neubauer@intel.com \
/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).