All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Wilck <mwilck@suse.com>
To: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: dm-devel@redhat.com, Martin Wilck <mwilck@suse.com>
Subject: [PATCH 3/3] libmultipath: more debug output in alua prioritizer
Date: Tue,  3 Jul 2018 09:57:07 +0200	[thread overview]
Message-ID: <20180703075707.834-3-mwilck@suse.com> (raw)
In-Reply-To: <20180703075707.834-1-mwilck@suse.com>

Help debug problems with ALUA commands by emitting more
meaningful error messages.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 libmultipath/prioritizers/alua.c      |  5 ++++-
 libmultipath/prioritizers/alua_rtpg.c | 16 ++++++++++++----
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/libmultipath/prioritizers/alua.c b/libmultipath/prioritizers/alua.c
index 03d0a0e0..b24e2d48 100644
--- a/libmultipath/prioritizers/alua.c
+++ b/libmultipath/prioritizers/alua.c
@@ -67,8 +67,11 @@ get_alua_info(struct path * pp, unsigned int timeout)
 	}
 	condlog(3, "%s: reported target port group is %i", pp->dev, tpg);
 	rc = get_asymmetric_access_state(pp->fd, tpg, timeout);
-	if (rc < 0)
+	if (rc < 0) {
+		condlog(2, "%s: get_asymmetric_access_state returned %d",
+			__func__, rc);
 		return -ALUA_PRIO_GETAAS_FAILED;
+	}
 
 	condlog(3, "%s: aas = %02x [%s]%s", pp->dev, rc, aas_print_string(rc),
 		(rc & 0x80) ? " [preferred]" : "");
diff --git a/libmultipath/prioritizers/alua_rtpg.c b/libmultipath/prioritizers/alua_rtpg.c
index 34b5f3ce..811ce7a2 100644
--- a/libmultipath/prioritizers/alua_rtpg.c
+++ b/libmultipath/prioritizers/alua_rtpg.c
@@ -19,6 +19,7 @@
 #include <sys/ioctl.h>
 #include <inttypes.h>
 #include <libudev.h>
+#include <errno.h>
 
 #define __user
 #include <scsi/sg.h>
@@ -318,8 +319,11 @@ retry:
 	hdr.sbp			= sense;
 	hdr.timeout		= get_prio_timeout(timeout, SGIO_TIMEOUT);
 
-	if (ioctl(fd, SG_IO, &hdr) < 0)
+	if (ioctl(fd, SG_IO, &hdr) < 0) {
+		condlog(2, "%s: sg ioctl failed: %s",
+			__func__, strerror(errno));
 		return -RTPG_RTPG_FAILED;
+	}
 
 	rc = scsi_error(&hdr, OPERATION_CODE_RTPG);
 	if (rc == SCSI_ERROR) {
@@ -355,8 +359,10 @@ get_asymmetric_access_state(int fd, unsigned int tpg, unsigned int timeout)
 	}
 	memset(buf, 0, buflen);
 	rc = do_rtpg(fd, buf, buflen, timeout);
-	if (rc < 0)
+	if (rc < 0) {
+		PRINT_DEBUG("%s: do_rtpg returned %d", __func__, rc);
 		goto out;
+	}
 	scsi_buflen = get_unaligned_be32(&buf[0]) + 4;
 	if (scsi_buflen > UINT_MAX)
 		scsi_buflen = UINT_MAX;
@@ -364,8 +370,8 @@ get_asymmetric_access_state(int fd, unsigned int tpg, unsigned int timeout)
 		free(buf);
 		buf = (unsigned char *)malloc(scsi_buflen);
 		if (!buf) {
-			PRINT_DEBUG ("malloc failed: could not allocate"
-				"%u bytes", scsi_buflen);
+			PRINT_DEBUG("malloc failed: could not allocate %"
+				    PRIu64 " bytes", scsi_buflen);
 			return -RTPG_RTPG_FAILED;
 		}
 		buflen = scsi_buflen;
@@ -389,6 +395,8 @@ get_asymmetric_access_state(int fd, unsigned int tpg, unsigned int timeout)
 			}
 		}
 	}
+	if (rc == -RTPG_TPG_NOT_FOUND)
+		condlog(2, "%s: port group %d not found", __func__, tpg);
 out:
 	free(buf);
 	return rc;
-- 
2.17.1

  parent reply	other threads:[~2018-07-03  7:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-03  7:57 [PATCH 1/3] libmultipath: alua_rtpg: use condlog for error messages Martin Wilck
2018-07-03  7:57 ` [PATCH 2/3] libmultipath: alua: retry RTPG for NOT_READY and UNIT_ATTENTION Martin Wilck
2018-07-13 19:08   ` Benjamin Marzinski
2018-07-03  7:57 ` Martin Wilck [this message]
2018-07-13 19:09   ` [PATCH 3/3] libmultipath: more debug output in alua prioritizer Benjamin Marzinski
2018-07-13 19:08 ` [PATCH 1/3] libmultipath: alua_rtpg: use condlog for error messages Benjamin Marzinski

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=20180703075707.834-3-mwilck@suse.com \
    --to=mwilck@suse.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.