From: Hannes Reinecke <hare@suse.de>
To: Christophe Varoqui <christophe.varoqui@gmail.com>
Cc: dm-devel@redhat.com
Subject: [PATCH 23/29] Do not print error when rport is blocked
Date: Mon, 15 Jul 2013 15:00:24 +0200 [thread overview]
Message-ID: <1373893230-26077-24-git-send-email-hare@suse.de> (raw)
In-Reply-To: <1373893230-26077-1-git-send-email-hare@suse.de>
When an rport is blocked any write to the dev_loss_tmo
attribute will fail with EBUSY. But that's perfectly
normal and nothing to worry about, so decrease the
logging priority for these cases.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/discovery.c | 52 ++++++++++++++++++++++++++++++----------------
libmultipath/sysfs.c | 20 +++++++++---------
2 files changed, 44 insertions(+), 28 deletions(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index e9c6a50..092930a 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -324,6 +324,7 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp)
char value[11];
char rport_id[32];
unsigned long long tmo = 0;
+ int ret;
sprintf(rport_id, "rport-%d:%d-%d",
pp->sg_id.host_no, pp->sg_id.channel, pp->sg_id.transport_id);
@@ -353,15 +354,16 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp)
mpp->fast_io_fail != MP_FAST_IO_FAIL_ZERO &&
mpp->fast_io_fail != MP_FAST_IO_FAIL_OFF) {
/* Check if we need to temporarily increase dev_loss_tmo */
- if (sysfs_attr_get_value(rport_dev, "dev_loss_tmo",
- value, 16) <= 0) {
+ ret = sysfs_attr_get_value(rport_dev, "dev_loss_tmo",
+ value, 16);
+ if (ret <= 0) {
condlog(0, "%s: failed to read dev_loss_tmo value, "
- "error %d", pp->dev, errno);
+ "error %d", rport_id, -ret);
goto out;
}
if (sscanf(value, "%llu\n", &tmo) != 1) {
condlog(0, "%s: Cannot parse dev_loss_tmo "
- "attribute '%s'",pp->dev, value);
+ "attribute '%s'", rport_id, value);
goto out;
}
if (mpp->fast_io_fail >= tmo) {
@@ -369,16 +371,21 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp)
}
} else if (mpp->dev_loss > 600) {
condlog(3, "%s: limiting dev_loss_tmo to 600, since "
- "fast_io_fail is not set", pp->dev);
+ "fast_io_fail is not set", rport_id);
snprintf(value, 11, "%u", 600);
} else {
snprintf(value, 11, "%u", mpp->dev_loss);
}
- if (strlen(value) &&
- sysfs_attr_set_value(rport_dev, "dev_loss_tmo", value, 11) <= 0) {
- condlog(0, "%s failed to set dev_loss_tmo",
- mpp->alias);
- goto out;
+ if (strlen(value)) {
+ ret = sysfs_attr_set_value(rport_dev, "dev_loss_tmo", value, 11);
+ if (ret <= 0) {
+ if (ret == -EBUSY)
+ condlog(3, "%s: rport blocked", rport_id);
+ else
+ condlog(0, "%s: failed to set dev_loss_tmo to %s, error %d",
+ rport_id, value, -ret);
+ goto out;
+ }
}
if (mpp->fast_io_fail != MP_FAST_IO_FAIL_UNSET) {
if (mpp->fast_io_fail == MP_FAST_IO_FAIL_OFF)
@@ -387,18 +394,27 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp)
sprintf(value, "0");
else
snprintf(value, 11, "%u", mpp->fast_io_fail);
- if (sysfs_attr_set_value(rport_dev, "fast_io_fail_tmo",
- value, 11) <= 0) {
- condlog(0, "%s failed to set fast_io_fail_tmo",
- mpp->alias);
+ ret = sysfs_attr_set_value(rport_dev, "fast_io_fail_tmo",
+ value, 11);
+ if (ret <= 0) {
+ if (ret == -EBUSY)
+ condlog(3, "%s: rport blocked", rport_id);
+ else
+ condlog(0, "%s: failed to set fast_io_fail_tmo to %s, error %d",
+ rport_id, value, -ret);
}
}
if (tmo > 0) {
snprintf(value, 11, "%u", mpp->dev_loss);
- if (sysfs_attr_set_value(rport_dev, "dev_loss_tmo",
- value, 11) <= 0)
- condlog(0, "%s failed to set dev_loss_tmo",
- mpp->alias);
+ ret = sysfs_attr_set_value(rport_dev, "dev_loss_tmo",
+ value, 11);
+ if (ret <= 0) {
+ if (ret == -EBUSY)
+ condlog(3, "%s: rport blocked", rport_id);
+ else
+ condlog(0, "%s: failed to set dev_loss_tmo to %s, error %d",
+ rport_id, value, -ret);
+ }
}
out:
udev_device_unref(rport_dev);
diff --git a/libmultipath/sysfs.c b/libmultipath/sysfs.c
index bab3837..0670e0a 100644
--- a/libmultipath/sysfs.c
+++ b/libmultipath/sysfs.c
@@ -59,19 +59,19 @@ ssize_t sysfs_attr_get_value(struct udev_device *dev, const char *attr_name,
condlog(4, "open '%s'", devpath);
if (stat(devpath, &statbuf) != 0) {
condlog(4, "stat '%s' failed: %s", devpath, strerror(errno));
- return 0;
+ return -errno;
}
/* skip directories */
if (S_ISDIR(statbuf.st_mode)) {
condlog(4, "%s is a directory", devpath);
- return 0;
+ return -EISDIR;
}
/* skip non-writeable files */
if ((statbuf.st_mode & S_IRUSR) == 0) {
condlog(4, "%s is not readable", devpath);
- return 0;
+ return -EPERM;
}
/* read attribute value */
@@ -79,12 +79,12 @@ ssize_t sysfs_attr_get_value(struct udev_device *dev, const char *attr_name,
if (fd < 0) {
condlog(4, "attribute '%s' can not be opened: %s",
devpath, strerror(errno));
- return 0;
+ return -errno;
}
size = read(fd, value, value_len);
if (size < 0) {
condlog(4, "read from %s failed: %s", devpath, strerror(errno));
- size = 0;
+ size = -errno;
} else if (size == value_len) {
condlog(4, "overflow while reading from %s", devpath);
size = 0;
@@ -110,19 +110,19 @@ ssize_t sysfs_attr_set_value(struct udev_device *dev, const char *attr_name,
condlog(4, "open '%s'", devpath);
if (stat(devpath, &statbuf) != 0) {
condlog(4, "stat '%s' failed: %s", devpath, strerror(errno));
- return 0;
+ return -errno;
}
/* skip directories */
if (S_ISDIR(statbuf.st_mode)) {
condlog(4, "%s is a directory", devpath);
- return 0;
+ return -EISDIR;
}
/* skip non-writeable files */
if ((statbuf.st_mode & S_IWUSR) == 0) {
condlog(4, "%s is not writeable", devpath);
- return 0;
+ return -EPERM;
}
/* write attribute value */
@@ -130,12 +130,12 @@ ssize_t sysfs_attr_set_value(struct udev_device *dev, const char *attr_name,
if (fd < 0) {
condlog(4, "attribute '%s' can not be opened: %s",
devpath, strerror(errno));
- return 0;
+ return -errno;
}
size = write(fd, value, value_len);
if (size < 0) {
condlog(4, "write to %s failed: %s", devpath, strerror(errno));
- size = 0;
+ size = -errno;
} else if (size < value_len) {
condlog(4, "tried to write %ld to %s. Wrote %ld",
(long)value_len, devpath, (long)size);
--
1.7.10.4
next prev parent reply other threads:[~2013-07-15 13:00 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-15 13:00 [PATCH 00/29] SLES resync Hannes Reinecke
2013-07-15 13:00 ` [PATCH 01/29] multipath: bind lifetime of udev context to main thread Hannes Reinecke
2013-07-15 13:00 ` [PATCH 02/29] Document 'infinity' as possible value for dev_loss_tmo Hannes Reinecke
2013-07-15 13:00 ` [PATCH 03/29] alua: Do not add preferred path priority for active/optimized Hannes Reinecke
2013-07-15 13:00 ` [PATCH 04/29] multipath: Increase dev_loss_tmo prior to fast_io_fail Hannes Reinecke
2013-07-15 13:00 ` [PATCH 05/29] libmultipath: return PATH_DOWN for quiesced paths Hannes Reinecke
2013-07-15 13:00 ` [PATCH 06/29] libmultipath: Implement PATH_TIMEOUT Hannes Reinecke
2013-07-15 13:00 ` [PATCH 07/29] Deprecate pg_timeout Hannes Reinecke
2013-07-15 13:00 ` [PATCH 08/29] kpartx: create correct symlinks for PATH_FAILED events Hannes Reinecke
2013-07-15 13:00 ` [PATCH 09/29] multipath: Deprecate 'getuid' configuration variable Hannes Reinecke
2013-07-15 13:00 ` [PATCH 10/29] kpartx: support disk with non-512B sectors Hannes Reinecke
2013-07-15 13:00 ` [PATCH 11/29] multipath: Add 'Datacore Virtual Disk' to internal hardware table Hannes Reinecke
2013-07-15 13:00 ` [PATCH 12/29] Minor fixes for priority handling Hannes Reinecke
2013-07-15 13:00 ` [PATCH 13/29] Check return value from pathinfo() Hannes Reinecke
2013-07-15 13:00 ` [PATCH 14/29] Read directly from sysfs when checking the device size Hannes Reinecke
2013-07-15 13:00 ` [PATCH 15/29] multipath.conf.annotated: Document rr_min_io_rq Hannes Reinecke
2013-07-15 13:00 ` [PATCH 16/29] Correctly print out 'max' for max_fds Hannes Reinecke
2013-07-15 13:00 ` [PATCH 17/29] Correctly set max_fds in case of failure Hannes Reinecke
2013-07-15 13:00 ` [PATCH 18/29] Update multipath.conf.defaults Hannes Reinecke
2013-07-15 13:00 ` [PATCH 19/29] Correctly set pgfailback Hannes Reinecke
2013-07-15 13:00 ` [PATCH 20/29] multipath.conf.5: clarify 'no_path_retry' default setting Hannes Reinecke
2013-07-15 13:00 ` [PATCH 21/29] multipath.conf.annotated: remove 'udev_dir' Hannes Reinecke
2013-07-15 13:00 ` [PATCH 22/29] multipath: Implement 'property' blacklist Hannes Reinecke
2013-07-15 13:00 ` Hannes Reinecke [this message]
2013-07-15 13:00 ` [PATCH 24/29] multipath: reference the udev context when starting event queue Hannes Reinecke
2013-07-15 13:00 ` [PATCH 25/29] multipathd: valgrind fixes Hannes Reinecke
2013-07-15 13:00 ` [PATCH 26/29] multipathd: increase stacksize for uevent listener Hannes Reinecke
2013-07-15 13:00 ` [PATCH 27/29] Specify checker_timeout in seconds Hannes Reinecke
2013-07-15 13:00 ` [PATCH 28/29] multipath: fix setting of fast_io_fail_tmo Hannes Reinecke
2013-07-15 13:00 ` [PATCH 29/29] multipath: reset queue_if_no_path if flush failed Hannes Reinecke
2013-07-15 13:53 ` [PATCH 00/29] SLES resync Sebastian Riemer
2013-07-15 14:12 ` Hannes Reinecke
2013-07-16 7:10 ` Hannes Reinecke
2013-07-16 9:20 ` Sebastian Riemer
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=1373893230-26077-24-git-send-email-hare@suse.de \
--to=hare@suse.de \
--cc=christophe.varoqui@gmail.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.