multipath: Fix some minor issues in path reordering code
Benjamin Marzinski
maintainerPATCH 1/1 multipath: Fix some minor issues in path reordering code
There were a couple of small issues with the path reordering code.
Since you may fail to get the adapter name at any time while looping through the paths, you need to clean up when this fails, instead of just exitting group_by_host_adapter().
I've looked at a couple kernels, and I don't see any sysfs file named:
/sys/class/iscsi_host/host<n>/ip_address
It's always:
/sys/class/iscsi_host/host<n>/ipaddress
Also /sys/class/iscsi_host/host<n>/ipaddress could be an IPv6 address, in which case we need 40 bytes to hold is, so SLOT_NAME_SIZE needs to be 40 bytes large.
--- libmultipath/configure.c | 2 +- libmultipath/discovery.c | 2 +- libmultipath/structs.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
libmultipath/configure.c +1 -1
@@ -56,7 +56,7 @@ int group_by_host_adapter(struct pathgroup *pgp, vector adapters) pp =VECTOR_SLOT (pgp->paths,0 );if (sysfs_get_host_adapter_name (pp, adapter_name1)) -return 1 ; + goto out;/* create a new host adapter group */ agp =alloc_adaptergroup ();
libmultipath/discovery.c +1 -1
@@ -397,7 +397,7 @@ int sysfs_get_iscsi_ip_address(struct path *pp, char *ip_address) "iscsi_host", host_name);if (hostdev) { value =udev_device_get_sysattr_value (hostdev, -"ip_address" ); +"ipaddress" );if (value) {strncpy (ip_address, value,SLOT_NAME_SIZE );udev_device_unref (hostdev);
libmultipath/structs.h +1 -1
@@ -16,7 +16,7 @@#define PATH_SIZE 512#define NAME_SIZE 512#define HOST_NAME_LEN 8 -#define SLOT_NAME_SIZE 32 +#define SLOT_NAME_SIZE 40#define SCSI_VENDOR_SIZE 9#define SCSI_PRODUCT_SIZE 17
Signature · 1 line
1.8.3.1
Quoted 13 lines
-----Original Message-----
From: Benjamin Marzinski [mailto:[email protected]]
Sent: Wednesday, May 21, 2014 2:03 PM
To: device-mapper development
Cc: Christophe Varoqui; Merla, ShivaKrishna
Subject: [PATCH] multipath: Fix some minor issues in path reordering codeThere were a couple of small issues with the path reordering code.
Since you may fail to get the adapter name at any time while looping through the paths, you need to clean up when this fails, instead of just exitting
group_by_host_adapter().
Quoted 9 lines
I've looked at a couple kernels, and I don't see any sysfs file named:
/sys/class/iscsi_host/host<n>/ip_address
It's always:
/sys/class/iscsi_host/host<n>/ipaddressAlso /sys/class/iscsi_host/host<n>/ipaddress could be an IPv6 address, in which case we need 40 bytes to hold is, so
SLOT_NAME_SIZEneeds to be 40 bytes large.
Ben, thanks for identifying and fixing these. I think I overlooked the ipaddress part as we were majorly testing on FC/SAS.