* [patch 1/1] drivers/scsi: fix proc_scsi_write to return "length" on success with remove-single-device case
@ 2006-04-26 21:41 akpm
2006-04-27 19:07 ` James Bottomley
0 siblings, 1 reply; 2+ messages in thread
From: akpm @ 2006-04-26 21:41 UTC (permalink / raw)
To: James.Bottomley; +Cc: linux-scsi, akpm, suzuki
From: Suzuki <suzuki@in.ibm.com>
proc_scsi_write doesn't return the "length" upon successfully removing a
device; instead it returns 0. This causes commands like "echo" to redo the
write(), which ends up in something like,
$ echo "scsi remove-single-device 0 0 3 0" > /proc/scsi/scsi
"-bash: echo: write error: No such device or address"
, even though the device was removed.
Signed-off-by: Suzuki K P <suzuki@in.ibm.com>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---
drivers/scsi/scsi_proc.c | 2 ++
1 files changed, 2 insertions(+)
diff -puN drivers/scsi/scsi_proc.c~drivers-scsi-fix-proc_scsi_write-to-return-length-on drivers/scsi/scsi_proc.c
--- 25/drivers/scsi/scsi_proc.c~drivers-scsi-fix-proc_scsi_write-to-return-length-on Wed Apr 26 14:39:48 2006
+++ 25-akpm/drivers/scsi/scsi_proc.c Wed Apr 26 14:39:48 2006
@@ -282,6 +282,8 @@ static ssize_t proc_scsi_write(struct fi
lun = simple_strtoul(p + 1, &p, 0);
err = scsi_remove_single_device(host, channel, id, lun);
+ if (!err)
+ err = length;
}
out:
_
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch 1/1] drivers/scsi: fix proc_scsi_write to return "length" on success with remove-single-device case
2006-04-26 21:41 [patch 1/1] drivers/scsi: fix proc_scsi_write to return "length" on success with remove-single-device case akpm
@ 2006-04-27 19:07 ` James Bottomley
0 siblings, 0 replies; 2+ messages in thread
From: James Bottomley @ 2006-04-27 19:07 UTC (permalink / raw)
To: akpm; +Cc: linux-scsi, suzuki
On Wed, 2006-04-26 at 14:41 -0700, akpm@osdl.org wrote:
> + if (!err)
> + err = length;
We have more than one of these cases; we might as well accommodate them
all at the bottom of the routine, like the attached
James
diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c
index 07be62b..55200e4 100644
--- a/drivers/scsi/scsi_proc.c
+++ b/drivers/scsi/scsi_proc.c
@@ -266,8 +266,6 @@ static ssize_t proc_scsi_write(struct fi
lun = simple_strtoul(p + 1, &p, 0);
err = scsi_add_single_device(host, channel, id, lun);
- if (err >= 0)
- err = length;
/*
* Usage: echo "scsi remove-single-device 0 1 2 3" >/proc/scsi/scsi
@@ -284,6 +282,13 @@ static ssize_t proc_scsi_write(struct fi
err = scsi_remove_single_device(host, channel, id, lun);
}
+ /*
+ * convert success returns so that we return the
+ * number of bytes consumed.
+ */
+ if (!err)
+ err = length;
+
out:
free_page((unsigned long)buffer);
return err;
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-04-27 19:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-26 21:41 [patch 1/1] drivers/scsi: fix proc_scsi_write to return "length" on success with remove-single-device case akpm
2006-04-27 19:07 ` James Bottomley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox