[dm-devel] [PATCH v3 23/24] multipathd: simplify retry logic in ev_add_path()

Martin Wilck mwilck at suse.com
Mon Dec 10 09:49:58 UTC 2018


Move the retry loop for DOMAP_RETRY out of the redundant outer
if conditional, and replace the goto construct with a while loop.

Signed-off-by: Martin Wilck <mwilck at suse.com>
---
 multipathd/main.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/multipathd/main.c b/multipathd/main.c
index fd3459f7..99145293 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -993,15 +993,14 @@ rescan:
 	/*
 	 * reload the map for the multipath mapped device
 	 */
-retry:
 	ret = domap(mpp, params, 1);
+	while (ret == DOMAP_RETRY && retries-- > 0) {
+		condlog(0, "%s: retry domap for addition of new "
+			"path %s", mpp->alias, pp->dev);
+		sleep(1);
+		ret = domap(mpp, params, 1);
+	}
 	if (ret == DOMAP_FAIL || ret == DOMAP_RETRY) {
-		if (ret == DOMAP_RETRY && 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);
 		/*
-- 
2.19.2




More information about the dm-devel mailing list