scsi_sysfs: Fix queue_ramp_up_period return code
PATCH 1/1 scsi_sysfs: Fix queue_ramp_up_period return code
Writing a number to /sys/bus/scsi/devices/<sdev>/queue_ramp_up_period returns the value of that number instead of the number of bytes written. This behavior can confuse programs expecting POSIX write() semantics. Fix this by returning the number of bytes written instead.
--- drivers/scsi/scsi_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_sysfs.c +1 -1
@@ -898,7 +898,7 @@ sdev_store_queue_ramp_up_period(struct device *dev,return -EINVAL ; sdev->queue_ramp_up_period =msecs_to_jiffies (period); -return period; +return count; } static DEVICE_ATTR(queue_ramp_up_period, S_IRUGO | S_IWUSR,
Signature · 1 line
2.3.0
Quoted 15 lines · Peter Oberparleiter
Writing a number to /sys/bus/scsi/devices/<sdev>/queue_ramp_up_period returns the value of that number instead of the number of bytes written. This behavior can confuse programs expecting POSIX
write()semantics. Fix this by returning the number of bytes written instead.Signed-off-by Peter Oberparleiter <[email protected]>--- drivers/scsi/scsi_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/scsi_sysfs.c +0
-0
drivers/scsi/scsi_sysfs.c sdev_store_queue_ramp_up_period(struct device *dev, · line 904
Quoted 8 lines
drivers/scsi/scsi_sysfs.c +1
-1@@ -898,7 +898,7 @@ sdev_store_queue_ramp_up_period(struct device *dev,return -EINVAL ; sdev->queue_ramp_up_period =msecs_to_jiffies (period); -return period; +return count; } static DEVICE_ATTR(queue_ramp_up_period, S_IRUGO | S_IWUSR,
Hello Peter,
Good catch. But please CC the people who introduced this code and also "stable" (see also commit 4a84067dbfce436b81779e585bf712b02ceee552).
Thanks,
Bart.
Quoted 16 lines · Peter Oberparleiter
Writing a number to /sys/bus/scsi/devices/<sdev>/queue_ramp_up_period returns the value of that number instead of the number of bytes written. This behavior can confuse programs expecting POSIX
write()semantics. Fix this by returning the number of bytes written instead.Signed-off-by Peter Oberparleiter <[email protected]>--- drivers/scsi/scsi_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/scsi_sysfs.c +0
-0
drivers/scsi/scsi_sysfs.c sdev_store_queue_ramp_up_period(struct device *dev, · line 904
Quoted 8 lines
drivers/scsi/scsi_sysfs.c +1
-1@@ -898,7 +898,7 @@ sdev_store_queue_ramp_up_period(struct device *dev,return -EINVAL ; sdev->queue_ramp_up_period =msecs_to_jiffies (period); -return period; +return count; } static DEVICE_ATTR(queue_ramp_up_period, S_IRUGO | S_IWUSR,
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke zSeries & Storage [email protected] +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
Quoted 15 lines · Peter Oberparleiter
Writing a number to /sys/bus/scsi/devices/<sdev>/queue_ramp_up_period returns the value of that number instead of the number of bytes written. This behavior can confuse programs expecting POSIX
write()semantics. Fix this by returning the number of bytes written instead.Signed-off-by Peter Oberparleiter <[email protected]>--- drivers/scsi/scsi_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/scsi_sysfs.c +0
-0
drivers/scsi/scsi_sysfs.c sdev_store_queue_ramp_up_period(struct device *dev, · line 904
Quoted 8 lines
drivers/scsi/scsi_sysfs.c +1
-1@@ -898,7 +898,7 @@ sdev_store_queue_ramp_up_period(struct device *dev,return -EINVAL ; sdev->queue_ramp_up_period =msecs_to_jiffies (period); -return period; +return count; } static DEVICE_ATTR(queue_ramp_up_period, S_IRUGO | S_IWUSR,