If we succeed, we should report that. Signed-off-by: Oliver Neukum <oneukum@xxxxxxxx> --- drivers/usb/storage/uas.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c index d388e78..31ff1a0 100644 --- a/drivers/usb/storage/uas.c +++ b/drivers/usb/storage/uas.c @@ -57,6 +57,7 @@ struct uas_dev_info { spinlock_t lock; struct work_struct work; struct completion deathknell; + bool aborted; }; enum { @@ -257,8 +258,20 @@ static void uas_xfer_data(struct urb *urb, struct scsi_cmnd *cmnd, } } -static void finish_tmf(struct uas_dev_info *devinfo, struct response_iu *riu) +static void finish_tmf(struct uas_dev_info *devinfo, struct response_iu *riu, struct scsi_cmnd *cmnd) { + u8 response_code = riu->response_code; + + /* + * We have a valid finished TMF and now need to check + * for the result of the operation + */ + uas_log_cmd_state(cmnd, "expected response iu", response_code); + + if (response_code == RC_TMF_SUCCEEDED) + devinfo->aborted = true; + else + devinfo->aborted = false; } static bool uas_evaluate_response_iu(struct response_iu *riu, struct scsi_cmnd *cmnd) @@ -385,7 +398,7 @@ static void uas_stat_cmplt(struct urb *urb) cmdinfo = (void *)&cmnd->SCp; switch (iu->iu_id) { case IU_ID_RESPONSE: - finish_tmf(devinfo, (struct response_iu *)iu); + finish_tmf(devinfo, (struct response_iu *)iu, cmnd); break; case IU_ID_STATUS: case IU_ID_READ_READY: @@ -810,7 +823,7 @@ static int uas_eh_abort_handler(struct scsi_cmnd *cmnd) time = wait_for_completion_timeout(&devinfo->deathknell, USB_CTRL_GET_TIMEOUT); /* in case of timeout */ usb_kill_urb(devinfo->management_urb); - if (time) { + if (time && devinfo->aborted) { cmdinfo->state &= ~COMMAND_ABORTING; /* * manually finish as resources must be freed only once -- 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