Skip to contentSkip to conversation

scsi_sysfs: Fix queue_ramp_up_period return code

PATCH Superseded Peter Oberparleiter 4 participants 4 messages Oct 26, 2015 – Oct 27, 2015 SCSI

lore
Share & tools
lore
#0 lore raw

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
index b333389..6b0f292 100644
@@ -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
#1 lore raw
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.

---
  drivers/scsi/scsi_sysfs.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_sysfs.c +0 -0
index b333389..6b0f292 100644

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.

Reviewed-by on v1 1/1
#2 lore raw
In reply to Peter Oberparleiter
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.

---
 drivers/scsi/scsi_sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_sysfs.c +0 -0
index b333389..6b0f292 100644

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)
Reviewed-by on v1 1/1
#3 lore raw
In reply to Peter Oberparleiter
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.

---
 drivers/scsi/scsi_sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_sysfs.c +0 -0
index b333389..6b0f292 100644

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,