All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Christophe Varoqui <christophe.varoqui@gmail.com>
Cc: dm-devel@redhat.com
Subject: [PATCH 13/30] Check return value from pathinfo()
Date: Tue, 16 Jul 2013 09:13:04 +0200	[thread overview]
Message-ID: <1373958801-103613-14-git-send-email-hare@suse.de> (raw)
In-Reply-To: <1373958801-103613-1-git-send-email-hare@suse.de>

pathinfo() has a return value, which should be checked to catch
any abnormal behaviour.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 libmultipath/configure.c | 10 ++++++++--
 libmultipath/discovery.c |  6 ++++--
 multipath/main.c         | 15 ++++++++++-----
 3 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 1cf46cc..7f5e065 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -793,8 +793,14 @@ extern int reload_map(struct vectors *vecs, struct multipath *mpp, int refresh)
 
 	update_mpp_paths(mpp, vecs->pathvec);
 	if (refresh) {
-		vector_foreach_slot (mpp->paths, pp, i)
-			pathinfo(pp, conf->hwtable, DI_PRIO);
+		vector_foreach_slot (mpp->paths, pp, i) {
+			r = pathinfo(pp, conf->hwtable, DI_PRIO);
+			if (r) {
+				condlog(2, "%s: failed to refresh pathinfo",
+					mpp->alias);
+				return 1;
+			}
+		}
 	}
 	if (setup_map(mpp, params, PARAMS_SIZE)) {
 		condlog(0, "%s: failed to setup map", mpp->alias);
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index a482c53..96fe985 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -125,8 +125,10 @@ path_discovery (vector pathvec, struct config * conf, int flag)
 			continue;
 		}
 		devtype = udev_device_get_devtype(udevice);
-		if(devtype && !strncmp(devtype, "disk", 4))
-			r += path_discover(pathvec, conf, udevice, flag);
+		if(devtype && !strncmp(devtype, "disk", 4)) {
+			r += path_discover(pathvec, conf,
+						   udevice, flag);
+		}
 		udev_device_unref(udevice);
 	}
 	udev_enumerate_unref(udev_iter);
diff --git a/multipath/main.c b/multipath/main.c
index 4a8b966..842a787 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -152,16 +152,21 @@ update_paths (struct multipath * mpp)
 					continue;
 				}
 				pp->mpp = mpp;
-				pathinfo(pp, conf->hwtable, DI_ALL);
+				if (pathinfo(pp, conf->hwtable, DI_ALL))
+					pp->state = PATH_UNCHECKED;
 				continue;
 			}
 			pp->mpp = mpp;
 			if (pp->state == PATH_UNCHECKED ||
-			    pp->state == PATH_WILD)
-				pathinfo(pp, conf->hwtable, DI_CHECKER);
+			    pp->state == PATH_WILD) {
+				if (pathinfo(pp, conf->hwtable, DI_CHECKER))
+					pp->state = PATH_UNCHECKED;
+			}
 
-			if (pp->priority == PRIO_UNDEF)
-				pathinfo(pp, conf->hwtable, DI_PRIO);
+			if (pp->priority == PRIO_UNDEF) {
+				if (pathinfo(pp, conf->hwtable, DI_PRIO))
+					pp->priority = PRIO_UNDEF;
+			}
 		}
 	}
 	return 0;
-- 
1.7.12.4

  parent reply	other threads:[~2013-07-16  7:13 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-16  7:12 [PATCH 00/30] SLES resync, second try Hannes Reinecke
2013-07-16  7:12 ` [PATCH 01/30] multipath: bind lifetime of udev context to main thread Hannes Reinecke
2013-07-16  7:12 ` [PATCH 02/30] Document 'infinity' as possible value for dev_loss_tmo Hannes Reinecke
2013-07-16  7:12 ` [PATCH 03/30] alua: Do not add preferred path priority for active/optimized Hannes Reinecke
2013-07-16  7:12 ` [PATCH 04/30] multipath: Increase dev_loss_tmo prior to fast_io_fail Hannes Reinecke
2013-07-19 21:17   ` Benjamin Marzinski
2013-07-22  7:19     ` Hannes Reinecke
2013-07-16  7:12 ` [PATCH 05/30] libmultipath: return PATH_DOWN for quiesced paths Hannes Reinecke
2013-07-16  7:12 ` [PATCH 06/30] libmultipath: Implement PATH_TIMEOUT Hannes Reinecke
2013-07-16  7:12 ` [PATCH 07/30] Deprecate pg_timeout Hannes Reinecke
2013-07-16  7:12 ` [PATCH 08/30] kpartx: create correct symlinks for PATH_FAILED events Hannes Reinecke
2013-07-16  7:13 ` [PATCH 09/30] multipath: Deprecate 'getuid' configuration variable Hannes Reinecke
2013-07-16  7:13 ` [PATCH 10/30] kpartx: support disk with non-512B sectors Hannes Reinecke
2013-07-16  7:13 ` [PATCH 11/30] multipath: Add 'Datacore Virtual Disk' to internal hardware table Hannes Reinecke
2013-07-16  7:13 ` [PATCH 12/30] Minor fixes for priority handling Hannes Reinecke
2013-07-16  7:13 ` Hannes Reinecke [this message]
2013-07-16  7:13 ` [PATCH 14/30] Read directly from sysfs when checking the device size Hannes Reinecke
2013-07-16  7:13 ` [PATCH 15/30] multipath.conf.annotated: Document rr_min_io_rq Hannes Reinecke
2013-07-16  7:13 ` [PATCH 16/30] Correctly print out 'max' for max_fds Hannes Reinecke
2013-07-16  7:13 ` [PATCH 17/30] Correctly set max_fds in case of failure Hannes Reinecke
2013-07-16  7:13 ` [PATCH 18/30] Update multipath.conf.defaults Hannes Reinecke
2013-07-16  7:13 ` [PATCH 19/30] Correctly set pgfailback Hannes Reinecke
2013-07-16  7:13 ` [PATCH 20/30] multipath.conf.5: clarify 'no_path_retry' default setting Hannes Reinecke
2013-07-16  7:13 ` [PATCH 21/30] multipath.conf.annotated: remove 'udev_dir' Hannes Reinecke
2013-07-16  7:13 ` [PATCH 22/30] multipath: Implement 'property' blacklist Hannes Reinecke
2014-08-21 16:37   ` Bart Van Assche
2014-08-21 19:31     ` Hannes Reinecke
2014-11-07  9:04       ` Bart Van Assche
2014-11-07  9:09         ` Hannes Reinecke
2014-11-19  5:33         ` Benjamin Marzinski
2013-07-16  7:13 ` [PATCH 23/30] Do not print error when rport is blocked Hannes Reinecke
2013-07-16  7:13 ` [PATCH 24/30] multipath: reference the udev context when starting event queue Hannes Reinecke
2013-07-16  7:13 ` [PATCH 25/30] multipathd: valgrind fixes Hannes Reinecke
2013-07-16  7:13 ` [PATCH 26/30] multipathd: increase stacksize for uevent listener Hannes Reinecke
2013-07-16  7:13 ` [PATCH 27/30] Specify checker_timeout in seconds Hannes Reinecke
2013-07-16  7:13 ` [PATCH 28/30] multipath: fix setting of fast_io_fail_tmo Hannes Reinecke
2013-07-16  7:13 ` [PATCH 29/30] multipath: reset queue_if_no_path if flush failed Hannes Reinecke
2013-07-16  7:13 ` [PATCH 30/30] libmultipath: read path state directly from sysfs Hannes Reinecke
2013-07-16 20:21 ` [PATCH 00/30] SLES resync, second try 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=1373958801-103613-14-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.