[PATCH 05/14] uas: actually use TASK_ABORT iu

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Issue a TASK_ABORT iu to the device and wait for it
to complete.

Signed-off-by: Oliver Neukum <oneukum@xxxxxxxx>
---
 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 06211ee..d8e70f7 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -55,6 +55,7 @@ struct uas_dev_info {
 	spinlock_t lock;
 	struct work_struct work;
 	struct mutex management_mutex;
+	struct completion deathknell;
 };
 
 enum {
@@ -431,6 +432,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,
@@ -734,6 +739,7 @@ static int uas_eh_abort_handler(struct scsi_cmnd *cmnd)
 	cmdinfo->state |= COMMAND_ABORTED;
 
 	mutex_lock(&devinfo->management_mutex);
+	init_completion(&devinfo->deathknell);
 	usb_fill_bulk_urb(devinfo->management_urb,
 			  devinfo->udev,
 			  devinfo->cmd_pipe, /* shared */
@@ -750,6 +756,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:
 	mutex_unlock(&devinfo->management_mutex);
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux