aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_proc.c
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@steeleye.com>2006-04-27 15:07:49 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-05-10 11:22:30 -0400
commit2ca48a132167f9f12efba179382979aafde0ab36 (patch)
tree4eb3bbce62ac02590d6b49e5529ff90c0253b0fd /drivers/scsi/scsi_proc.c
parent665b44aee34e9f2c64558df4ec01d40576e45651 (diff)
[SCSI] fix proc_scsi_write to return "length" on success with remove-single-device case
Problem spotted by: Suzuki K P <suzuki@in.ibm.com> A zero return on success isn't correct for filesystem write functions. They should either return negative error or the length of bytes consumed. Add code to convert our zero on success error return to return the length of bytes passed in. This fixes the following: $ echo "scsi remove-single-device 0 0 3 0" > /proc/scsi/scsi bash: echo: write error: No such device or address" Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/scsi_proc.c')
-rw-r--r--drivers/scsi/scsi_proc.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c
index 07be62bbaae..55200e4fdf1 100644
--- a/drivers/scsi/scsi_proc.c
+++ b/drivers/scsi/scsi_proc.c
@@ -266,8 +266,6 @@ static ssize_t proc_scsi_write(struct file *file, const char __user *buf,
266 lun = simple_strtoul(p + 1, &p, 0); 266 lun = simple_strtoul(p + 1, &p, 0);
267 267
268 err = scsi_add_single_device(host, channel, id, lun); 268 err = scsi_add_single_device(host, channel, id, lun);
269 if (err >= 0)
270 err = length;
271 269
272 /* 270 /*
273 * Usage: echo "scsi remove-single-device 0 1 2 3" >/proc/scsi/scsi 271 * Usage: echo "scsi remove-single-device 0 1 2 3" >/proc/scsi/scsi
@@ -284,6 +282,13 @@ static ssize_t proc_scsi_write(struct file *file, const char __user *buf,
284 err = scsi_remove_single_device(host, channel, id, lun); 282 err = scsi_remove_single_device(host, channel, id, lun);
285 } 283 }
286 284
285 /*
286 * convert success returns so that we return the
287 * number of bytes consumed.
288 */
289 if (!err)
290 err = length;
291
287 out: 292 out:
288 free_page((unsigned long)buffer); 293 free_page((unsigned long)buffer);
289 return err; 294 return err;