diff mbox

[28/78] multipathd: handle DOMAP_RETRY

Message ID 1426509425-15978-29-git-send-email-hare@suse.de (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show

Commit Message

Hannes Reinecke March 16, 2015, 12:36 p.m. UTC
Calling domap() will first check if all paths are available by
using 'flock' on each path. This might fail if other processes
are holding the lock already. In these cases we should retry
domap() as the processes should terminate eventually.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 multipathd/main.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/multipathd/main.c b/multipathd/main.c
index 2107113..494f4bb 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -467,6 +467,7 @@  ev_add_path (struct path * pp, struct vectors * vecs)
 	char params[PARAMS_SIZE] = {0};
 	int retries = 3;
 	int start_waiter = 0;
+	int ret;
 
 	/*
 	 * need path UID to go any further
@@ -546,7 +547,15 @@  rescan:
 	/*
 	 * reload the map for the multipath mapped device
 	 */
-	if (domap(mpp, params) <= 0) {
+retry:
+	ret = domap(mpp, params);
+	if (ret <= 0) {
+		if (ret < 0 && retries-- > 0) {
+			condlog(0, "%s: retry domap for addition of new "
+				"path %s", mpp->alias, pp->dev);
+			sleep(1);
+			goto retry;
+		}
 		condlog(0, "%s: failed in domap for addition of new "
 			"path %s", mpp->alias, pp->dev);
 		/*