[PATCH] libmultipath: retry to get path serial number by get_serial() after failure by get_vpd_sysfs()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "tang.junhui" <tang.junhui@xxxxxxxxxx>

Some operating systems have no such file vpd_pg80 in sys directory
such as /sys/devices/platform/host23/session21/target23:0:0/23:0:0:33/,
so path serial number would be failed to get by get_vpd_sysfs(),
we need retry to get it by get_serial to avoid empty serial of the path.

Signed-off-by: tang.junhui <tang.junhui@xxxxxxxxxx>
---
 libmultipath/discovery.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 0974c92..bb3116d 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -1435,10 +1435,14 @@ scsi_ioctl_pathinfo (struct path * pp, int mask)
 	if (!attr_path || pp->sg_id.host_no == -1)
 		return 0;
 
-	if (get_vpd_sysfs(parent, 0x80, pp->serial, SERIAL_SIZE) > 0)
-		condlog(3, "%s: serial = %s",
-			pp->dev, pp->serial);
+	if (get_vpd_sysfs(parent, 0x80, pp->serial, SERIAL_SIZE) <= 0) {
+		if (get_serial(pp->serial, SERIAL_SIZE, pp->fd)) {
+			condlog(2, "%s: fail to get serial", pp->dev);
+			return 0;
+		}
+	}
 
+	condlog(3, "%s: serial = %s", pp->dev, pp->serial);
 	return 0;
 }
 
-- 
2.8.1.windows.1

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel



[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux