[dm-devel] [PATCH 28/78] multipathd: handle DOMAP_RETRY

Hannes Reinecke hare at suse.de
Mon Mar 16 12:36:15 UTC 2015


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 at suse.de>
---
 multipathd/main.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

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);
 		/*
-- 
1.8.4.5




More information about the dm-devel mailing list