[dm-devel] [PATCH 46/57] libmultipath: ensure 'dev_t' is set when store paths

Hannes Reinecke hare at suse.de
Wed Apr 27 11:10:47 UTC 2016


We need both, 'pp->dev' and 'pp->dev_t' for correct lookup to
work. So ensure dev_t is always being updated when storing a new path.

Signed-off-by: Hannes Reinecke <hare at suse.com>
---
 libmultipath/discovery.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 2cf2566..db82b00 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -1599,6 +1599,16 @@ pathinfo (struct path *pp, vector hwtable, int mask)
 	condlog(3, "%s: mask = 0x%x", pp->dev, mask);
 
 	/*
+	 * Sanity check: we need the device number to
+	 * avoid inconsistent information in
+	 * find_path_by_dev()/find_path_by_devt()
+	 */
+	if (!strlen(pp->dev_t) && !(mask & DI_SYSFS)) {
+		condlog(1, "%s: empty device number", pp->dev);
+		mask |= DI_SYSFS;
+	}
+
+	/*
 	 * fetch info available in sysfs
 	 */
 	if (mask & DI_SYSFS && sysfs_pathinfo(pp))
-- 
2.6.6




More information about the dm-devel mailing list