|
@@ -315,6 +315,7 @@ static int usb_stor_control_thread(void * __us)
|
|
{
|
|
{
|
|
struct us_data *us = (struct us_data *)__us;
|
|
struct us_data *us = (struct us_data *)__us;
|
|
struct Scsi_Host *host = us_to_host(us);
|
|
struct Scsi_Host *host = us_to_host(us);
|
|
|
|
+ struct scsi_cmnd *srb;
|
|
|
|
|
|
for (;;) {
|
|
for (;;) {
|
|
usb_stor_dbg(us, "*** thread sleeping\n");
|
|
usb_stor_dbg(us, "*** thread sleeping\n");
|
|
@@ -330,6 +331,7 @@ static int usb_stor_control_thread(void * __us)
|
|
scsi_lock(host);
|
|
scsi_lock(host);
|
|
|
|
|
|
/* When we are called with no command pending, we're done */
|
|
/* When we are called with no command pending, we're done */
|
|
|
|
+ srb = us->srb;
|
|
if (us->srb == NULL) {
|
|
if (us->srb == NULL) {
|
|
scsi_unlock(host);
|
|
scsi_unlock(host);
|
|
mutex_unlock(&us->dev_mutex);
|
|
mutex_unlock(&us->dev_mutex);
|
|
@@ -398,14 +400,11 @@ static int usb_stor_control_thread(void * __us)
|
|
/* lock access to the state */
|
|
/* lock access to the state */
|
|
scsi_lock(host);
|
|
scsi_lock(host);
|
|
|
|
|
|
- /* indicate that the command is done */
|
|
|
|
- if (us->srb->result != DID_ABORT << 16) {
|
|
|
|
- usb_stor_dbg(us, "scsi cmd done, result=0x%x\n",
|
|
|
|
- us->srb->result);
|
|
|
|
- us->srb->scsi_done(us->srb);
|
|
|
|
- } else {
|
|
|
|
|
|
+ /* was the command aborted? */
|
|
|
|
+ if (us->srb->result == DID_ABORT << 16) {
|
|
SkipForAbort:
|
|
SkipForAbort:
|
|
usb_stor_dbg(us, "scsi command aborted\n");
|
|
usb_stor_dbg(us, "scsi command aborted\n");
|
|
|
|
+ srb = NULL; /* Don't call srb->scsi_done() */
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -429,6 +428,13 @@ SkipForAbort:
|
|
|
|
|
|
/* unlock the device pointers */
|
|
/* unlock the device pointers */
|
|
mutex_unlock(&us->dev_mutex);
|
|
mutex_unlock(&us->dev_mutex);
|
|
|
|
+
|
|
|
|
+ /* now that the locks are released, notify the SCSI core */
|
|
|
|
+ if (srb) {
|
|
|
|
+ usb_stor_dbg(us, "scsi cmd done, result=0x%x\n",
|
|
|
|
+ srb->result);
|
|
|
|
+ srb->scsi_done(srb);
|
|
|
|
+ }
|
|
} /* for (;;) */
|
|
} /* for (;;) */
|
|
|
|
|
|
/* Wait until we are told to stop */
|
|
/* Wait until we are told to stop */
|