All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Wilck <mwilck@suse.com>
To: Christophe Varoqui <christophe.varoqui@opensvc.com>,
	Benjamin Marzinski <bmarzins@redhat.com>
Cc: dm-devel@redhat.com, Martin Wilck <mwilck@suse.com>
Subject: [PATCH v2 23/24] domap(): never return DOMAP_RETRY in daemon mode
Date: Mon,  3 Dec 2018 20:36:23 +0100	[thread overview]
Message-ID: <20181203193624.21870-6-mwilck@suse.com> (raw)
In-Reply-To: <20181203193624.21870-1-mwilck@suse.com>

DOMAP_RETRY is only used by the multipath tool. multipathd always treats
it exactly like DOMAP_FAIL. Simplify logic by only returning
DOMAP_RETRY in non-daemon mode from domap().

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 libmultipath/configure.c | 28 +++++++++++++---------------
 multipathd/main.c        |  9 +--------
 2 files changed, 14 insertions(+), 23 deletions(-)

diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 84ae5f56..1c549817 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -831,7 +831,7 @@ int domap(struct multipath *mpp, char *params, int is_daemon)
 		if (lock_multipath(mpp, 1)) {
 			condlog(3, "%s: failed to create map (in use)",
 				mpp->alias);
-			return DOMAP_RETRY;
+			return is_daemon ? DOMAP_FAIL : DOMAP_RETRY;
 		}
 
 		sysfs_set_max_sectors_kb(mpp, 0);
@@ -1110,20 +1110,18 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid,
 
 		r = domap(mpp, params, is_daemon);
 
-		if (r == DOMAP_FAIL || r == DOMAP_RETRY) {
-			condlog(3, "%s: domap (%u) failure "
-				   "for create/reload map",
-				mpp->alias, r);
-			if (r == DOMAP_FAIL || is_daemon) {
-				condlog(2, "%s: %s map",
-					mpp->alias, (mpp->action == ACT_CREATE)?
-					"ignoring" : "removing");
-				remove_map(mpp, vecs, 0);
-				continue;
-			} else /* if (r == DOMAP_RETRY && !is_daemon) */ {
-				ret = CP_RETRY;
-				goto out;
-			}
+		if (r == DOMAP_RETRY) {
+			/* This happens in non-daemon case only */
+			ret = CP_RETRY;
+			goto out;
+		}
+
+		if (r == DOMAP_FAIL) {
+			condlog(2, "%s: domap failure, %s map",
+				mpp->alias, (mpp->action == ACT_CREATE) ?
+				"ignoring" : "removing");
+			remove_map(mpp, vecs, 0);
+			continue;
 		}
 		if (r == DOMAP_DRY)
 			continue;
diff --git a/multipathd/main.c b/multipathd/main.c
index d0e7107c..1bf3c481 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -998,15 +998,8 @@ rescan:
 	/*
 	 * reload the map for the multipath mapped device
 	 */
-retry:
 	ret = domap(mpp, params, 1);
-	if (ret == DOMAP_FAIL || ret == DOMAP_RETRY) {
-		if (ret < 0 && retries-- > 0) {
-			condlog(0, "%s: retry domap for addition of new "
-				"path %s", mpp->alias, pp->dev);
-			sleep(1);
-			goto retry;
-		}
+	if (ret == DOMAP_FAIL) {
 		condlog(0, "%s: failed in domap for addition of new "
 			"path %s", mpp->alias, pp->dev);
 		/*
-- 
2.19.1

  parent reply	other threads:[~2018-12-03 19:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-03 19:36 [PATCH v2 00/24] multipath-tools: improve logging at -v3 Martin Wilck
2018-12-03 19:36 ` [PATCH v2 16/24] libmultipath: coalesce_paths: fix size mismatch handling Martin Wilck
2018-12-03 19:36 ` [PATCH v2 20/24] libmultipath: avoid syslog loglevel > LOG_DEBUG Martin Wilck
2018-12-03 19:36 ` [PATCH v2 21/24] coalesce_paths(): use symbolic return value Martin Wilck
2018-12-03 19:36 ` [PATCH v2 22/24] domap(): " Martin Wilck
2018-12-03 19:36 ` Martin Wilck [this message]
2018-12-03 23:45   ` [PATCH v2 23/24] domap(): never return DOMAP_RETRY in daemon mode Benjamin Marzinski
2018-12-09 21:06     ` Martin Wilck
2018-12-11 17:41       ` Benjamin Marzinski
2018-12-03 19:36 ` [PATCH v2 24/24] multipath: use symbolic return value and exit code Martin Wilck
2018-12-03 23:48   ` Benjamin Marzinski
2018-12-03 23:50 ` [PATCH v2 00/24] multipath-tools: improve logging at -v3 Benjamin Marzinski
2018-12-07 16:02   ` Christophe Varoqui

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=20181203193624.21870-6-mwilck@suse.com \
    --to=mwilck@suse.com \
    --cc=bmarzins@redhat.com \
    --cc=christophe.varoqui@opensvc.com \
    --cc=dm-devel@redhat.com \
    /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 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.