From: Suzuki 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 Cc: James Bottomley Signed-off-by: Andrew Morton --- 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: _