When formatting a disk from JBOD to RAID, we unbind the disk
from the sd driver, including the remote path, in the case of
dual adapters, and flush unused multipaths. However, due to
a bug, this code wasn't actually working once the SCSI
host, bus, or target exceeded a single character.

Signed-off-by: Brian King <brk...@linux.vnet.ibm.com>
---
 iprlib.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/iprlib.c b/iprlib.c
index 4d3ab5f..516f069 100644
--- a/iprlib.c
+++ b/iprlib.c
@@ -10345,7 +10345,8 @@ int ipr_jbod_sysfs_bind(struct ipr_dev *dev, u8 op)
        char *sysfs_device_name;
 
        sysfs_device_name = dev->scsi_dev_data->sysfs_device_name;
-       size = strnlen(sysfs_device_name, sizeof(sysfs_device_name));
+       size = strnlen(sysfs_device_name,
+                      sizeof(dev->scsi_dev_data->sysfs_device_name));
 
        if (op == IPR_JBOD_SYSFS_BIND) {
                fd = open("/sys/bus/scsi/drivers/sd/bind", O_WRONLY);
@@ -10367,7 +10368,8 @@ int ipr_jbod_sysfs_bind(struct ipr_dev *dev, u8 op)
        mp_dev = find_multipath_jbod(dev);
        if (mp_dev) {
                sysfs_device_name = mp_dev->scsi_dev_data->sysfs_device_name;
-               size = strnlen(sysfs_device_name, sizeof(sysfs_device_name));
+               size = strnlen(sysfs_device_name,
+                              
sizeof(mp_dev->scsi_dev_data->sysfs_device_name));
                rc = write(fd, sysfs_device_name, size);
                if (rc < 0) {
                        close(fd);
-- 
1.8.3.1



_______________________________________________
Iprdd-devel mailing list
Iprdd-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iprdd-devel

Reply via email to