Commit 5d390403 authored by Gerd Hoffmann's avatar Gerd Hoffmann Committed by Greg Kroah-Hartman

uas: improve abort handler

Two changes.  First we check whenever the request is linked in the work
list and if so take it out.  Second check whenever the command is
actually in flight before asking the device to cancel it via task
management, and in case it isn't just zap the data urbs and finish it.
Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent efefecf3
...@@ -715,8 +715,23 @@ static int uas_eh_abort_handler(struct scsi_cmnd *cmnd) ...@@ -715,8 +715,23 @@ static int uas_eh_abort_handler(struct scsi_cmnd *cmnd)
uas_log_cmd_state(cmnd, __func__); uas_log_cmd_state(cmnd, __func__);
spin_lock_irqsave(&devinfo->lock, flags); spin_lock_irqsave(&devinfo->lock, flags);
cmdinfo->state |= COMMAND_ABORTED; cmdinfo->state |= COMMAND_ABORTED;
spin_unlock_irqrestore(&devinfo->lock, flags); if (cmdinfo->state & IS_IN_WORK_LIST) {
ret = uas_eh_task_mgmt(cmnd, "ABORT TASK", TMF_ABORT_TASK); spin_lock(&uas_work_lock);
list_del(&cmdinfo->list);
cmdinfo->state &= ~IS_IN_WORK_LIST;
spin_unlock(&uas_work_lock);
}
if (cmdinfo->state & COMMAND_INFLIGHT) {
spin_unlock_irqrestore(&devinfo->lock, flags);
ret = uas_eh_task_mgmt(cmnd, "ABORT TASK", TMF_ABORT_TASK);
} else {
spin_unlock_irqrestore(&devinfo->lock, flags);
uas_unlink_data_urbs(devinfo, cmdinfo);
spin_lock_irqsave(&devinfo->lock, flags);
uas_try_complete(cmnd, __func__);
spin_unlock_irqrestore(&devinfo->lock, flags);
ret = SUCCESS;
}
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment