[dm-devel] [PATCH 47/54] libmultipath: get_refwwid(): use find_path_by_devt()

mwilck at suse.com mwilck at suse.com
Thu Jul 9 10:36:16 UTC 2020


From: Martin Wilck <mwilck at suse.com>

If get_refwwid is called with a dev_t argument, there's no point in converting
it into a devname first. If the device doesn't exist, get_udev_device() will fail.

Signed-off-by: Martin Wilck <mwilck at suse.com>
---
 libmultipath/configure.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 75e11fd..e8d6db8 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -1414,17 +1414,15 @@ int get_refwwid(enum mpath_cmds cmd, char *dev, enum devtypes dev_type,
 
 	if (dev_type == DEV_DEVT) {
 		strchop(dev);
-		if (devt2devname(buff, FILE_NAME_SIZE, dev)) {
-			condlog(0, "%s: cannot find block device\n", dev);
-			return 1;
-		}
-		pp = find_path_by_dev(pathvec, buff);
+		pp = find_path_by_devt(pathvec, dev);
 		if (!pp) {
 			struct udev_device *udevice =
 				get_udev_device(dev, dev_type);
 
-			if (!udevice)
+			if (!udevice) {
+				condlog(0, "%s: cannot find block device", dev);
 				return 1;
+			}
 
 			conf = get_multipath_config();
 			pthread_cleanup_push(put_multipath_config, conf);
-- 
2.26.2





More information about the dm-devel mailing list