All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Manage.c: Try to get EXCL access more times while stopping the array
@ 2013-04-03 12:47 Pawel Baldysiak
  0 siblings, 0 replies; 2+ messages in thread
From: Pawel Baldysiak @ 2013-04-03 12:47 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid, maciej.patelczyk, lukasz.dorau

If mdadm does not get EXCL access to the array, it should try again
after a while, because there still can be (for example)
a process of mdmon 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 |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/Manage.c b/Manage.c
index 6267c0c..23e7c85 100644
--- a/Manage.c
+++ b/Manage.c
@@ -222,7 +222,14 @@ 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 = 5;
+		while (((fd = open(devname, O_RDONLY|O_EXCL)) < 0 ||
+				strcmp(fd2devnm(fd), devnm) != 0) && count) {
+			if (fd >= 0)
+				close(fd);
+			usleep(200000);
+			count--;
+		}
 		if (fd < 0 || strcmp(fd2devnm(fd), devnm) != 0) {
 			if (fd >= 0)
 				close(fd);


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] Manage.c: Try to get EXCL access more times while stopping the array
@ 2013-04-10 14:00 Pawel Baldysiak
  0 siblings, 0 replies; 2+ messages in thread
From: Pawel Baldysiak @ 2013-04-10 14:00 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid, maciej.patelczyk, lukasz.dorau

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);


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-04-10 14:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-03 12:47 [PATCH] Manage.c: Try to get EXCL access more times while stopping the array Pawel Baldysiak
2013-04-10 14:00 Pawel Baldysiak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.