libmultipath: retry to get path serial number by get_serial() after failure by get_vpd_sysfs()
PATCH 1/1 libmultipath: retry to get path serial number by get_serial() after failure by get_vpd_sysfs()
From: "tang.junhui" <[email protected]>
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 <[email protected]>
--- libmultipath/discovery.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
libmultipath/discovery.c +7 -3
@@ -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 ; }
Signature · 1 line
2.8.1.windows.1