Skip to contentSkip to conversation

drivers/scsi : Fix proc_scsi_write to return "length" on success with remove-single-device case

PATCH New Suzuki 1 participant 1 message Apr 26, 2006 SCSI

lore
Share & tools
lore

Suzuki

author
#0 lore raw

PATCH 1/1 drivers/scsi : Fix proc_scsi_write to return "length" on success with remove-single-device case

Hi,

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"

, eventhough the device was removed.

Attached here is a patch to fix the issue.

* Fix proc_scsi_write to return "length" in remove-single-device case.

drivers/scsi/scsi_proc.new.c 2006-04-26 04:33:50.000000000 -0700 renamed from drivers/scsi/scsi_proc.c 2006-04-19 07:59:36.000000000 -0700 +2 -0
@@ -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:

Thanks,

Suzuki K P
Linux Technology Centre,
IBM Software Labs.