Issue a TASK_ABORT iu to the device and wait for it
to complete.
Signed-off-by: Oliver Neukum <[email protected]>
---
drivers/usb/storage/uas.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index 1b901c8..e69ef2b 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -54,6 +54,7 @@ struct uas_dev_info {
struct scsi_cmnd *cmnd[MAX_CMNDS];
spinlock_t lock;
struct work_struct work;
+ struct completion deathknell;
};
enum {
@@ -430,6 +431,10 @@ static void uas_cmd_cmplt(struct urb *urb)
static void uas_tmf_cmplt(struct urb *urb)
{
+ struct scsi_cmnd *cmnd = urb->context;
+ struct uas_dev_info *devinfo = (void *)cmnd->device->hostdata;
+
+ complete(&devinfo->deathknell);
}
static struct urb *uas_alloc_data_urb(struct uas_dev_info *devinfo, gfp_t gfp,
@@ -732,6 +737,7 @@ static int uas_eh_abort_handler(struct scsi_cmnd *cmnd)
/* Ensure that try_complete does not call scsi_done */
cmdinfo->state |= COMMAND_ABORTED;
+ init_completion(&devinfo->deathknell);
usb_fill_bulk_urb(devinfo->management_urb,
devinfo->udev,
devinfo->cmd_pipe, /* shared */
@@ -748,6 +754,9 @@ static int uas_eh_abort_handler(struct scsi_cmnd *cmnd)
if (err < 0) /* unkillable */
goto give_up;
+ wait_for_completion_timeout(&devinfo->deathknell, USB_CTRL_GET_TIMEOUT);
+ /* in case of timeout */
+ usb_kill_urb(devinfo->management_urb);
give_up:
/* Drop all refs to this cmnd, kill data urbs to break their ref */
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html