how to abort an ATIO/INOT

Chuck Tuffli chuck at tuffli.net
Thu Nov 3 23:53:27 UTC 2011


Hi -

I'm implementing a target mode driver using the scsi_target as a
back-end, and am seeing scsi_target hang sometimes when exiting. When
it hangs, the call stack appears to be

abort_all_pending
targdisable
targioctl(TARGIOCDISABLE)

with the "hang" due to the msleep on the pending_ccb_queue. If I
understand the code correctly (which I may not), the msleep is to wait
asynchronously for CCBs to abort.

But what about cases where the CCB completes prior to the msleep? For
example, some drivers call xpt_done on ATIO/INOT CCBs and then return
CAM_REQ_CMP for the abort (I copied this in my driver). I believe this
results in the hang as the abort request completes (status ==
CAM_REQ_CMP) triggering the msleep, but the xpt_done that could wake
up anything sleeping on the pending_ccb_queue has already run.

So, should target drivers not return CAM_REQ_CMP unless a CCB needs to
be asynchronously aborted? What about CTIO? Does that have a potential
race?

---chuck


More information about the freebsd-scsi mailing list