|
|
1422df |
commit b6ca22d980eb67b99ddadbfec8ce83b2ab00522c
|
|
|
1422df |
Author: Brian King <brking@linux.vnet.ibm.com>
|
|
|
1422df |
Date: Mon May 20 16:04:49 2019 -0500
|
|
|
1422df |
|
|
|
1422df |
iprutils: Fix driver unbind on format
|
|
|
1422df |
|
|
|
1422df |
When formatting a disk from JBOD to RAID, we unbind the disk
|
|
|
1422df |
from the sd driver, including the remote path, in the case of
|
|
|
1422df |
dual adapters, and flush unused multipaths. However, due to
|
|
|
1422df |
a bug, this code wasn't actually working once the SCSI
|
|
|
1422df |
host, bus, or target exceeded a single character.
|
|
|
1422df |
|
|
|
1422df |
Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
|
|
|
1422df |
|
|
|
1422df |
diff --git a/iprlib.c b/iprlib.c
|
|
|
1422df |
index 4d3ab5f..516f069 100644
|
|
|
1422df |
--- a/iprlib.c
|
|
|
1422df |
+++ b/iprlib.c
|
|
|
1422df |
@@ -10345,7 +10345,8 @@ int ipr_jbod_sysfs_bind(struct ipr_dev *dev, u8 op)
|
|
|
1422df |
char *sysfs_device_name;
|
|
|
1422df |
|
|
|
1422df |
sysfs_device_name = dev->scsi_dev_data->sysfs_device_name;
|
|
|
1422df |
- size = strnlen(sysfs_device_name, sizeof(sysfs_device_name));
|
|
|
1422df |
+ size = strnlen(sysfs_device_name,
|
|
|
1422df |
+ sizeof(dev->scsi_dev_data->sysfs_device_name));
|
|
|
1422df |
|
|
|
1422df |
if (op == IPR_JBOD_SYSFS_BIND) {
|
|
|
1422df |
fd = open("/sys/bus/scsi/drivers/sd/bind", O_WRONLY);
|
|
|
1422df |
@@ -10367,7 +10368,8 @@ int ipr_jbod_sysfs_bind(struct ipr_dev *dev, u8 op)
|
|
|
1422df |
mp_dev = find_multipath_jbod(dev);
|
|
|
1422df |
if (mp_dev) {
|
|
|
1422df |
sysfs_device_name = mp_dev->scsi_dev_data->sysfs_device_name;
|
|
|
1422df |
- size = strnlen(sysfs_device_name, sizeof(sysfs_device_name));
|
|
|
1422df |
+ size = strnlen(sysfs_device_name,
|
|
|
1422df |
+ sizeof(mp_dev->scsi_dev_data->sysfs_device_name));
|
|
|
1422df |
rc = write(fd, sysfs_device_name, size);
|
|
|
1422df |
if (rc < 0) {
|
|
|
1422df |
close(fd);
|