From: Pawel Baldysiak <pawel.baldysiak@intel.com>
To: neilb@suse.de
Cc: linux-raid@vger.kernel.org, maciej.patelczyk@intel.com,
lukasz.dorau@intel.com
Subject: [PATCH] Manage.c: Try to get EXCL access more times while stopping the array
Date: Wed, 10 Apr 2013 16:00:29 +0200 [thread overview]
Message-ID: <20130410140029.19194.22973.stgit@localhost.localdomain> (raw)
If mdadm does not get EXCL access to the array
and it is managed by mdmon, it should flush monitor
and try again, because there still can be (for example)
a process that is finishing aborting reshape.
If this fails couple of times, mdadm should stop trying,
print an error and abort stopping the array.
Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
---
Manage.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/Manage.c b/Manage.c
index 6267c0c..f557662 100644
--- a/Manage.c
+++ b/Manage.c
@@ -222,7 +222,15 @@ int Manage_runstop(char *devname, int fd, int runstop,
* to stop is probably a bad idea.
*/
close(fd);
- fd = open(devname, O_RDONLY|O_EXCL);
+ count = 10;
+ while (((fd = open(devname, O_RDONLY|O_EXCL)) < 0 ||
+ strcmp(fd2devnm(fd), devnm) != 0)
+ && mdmon_running(devnm) && count) {
+ if (fd >= 0)
+ close(fd);
+ flush_mdmon(devnm);
+ count--;
+ }
if (fd < 0 || strcmp(fd2devnm(fd), devnm) != 0) {
if (fd >= 0)
close(fd);
next reply other threads:[~2013-04-10 14:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-10 14:00 Pawel Baldysiak [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-04-03 12:47 [PATCH] Manage.c: Try to get EXCL access more times while stopping the array Pawel Baldysiak
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=20130410140029.19194.22973.stgit@localhost.localdomain \
--to=pawel.baldysiak@intel.com \
--cc=linux-raid@vger.kernel.org \
--cc=lukasz.dorau@intel.com \
--cc=maciej.patelczyk@intel.com \
--cc=neilb@suse.de \
/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