Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Nov 2011 16:29:07 -0700
From:      Chuck Tuffli <chuck@tuffli.net>
To:        freebsd-scsi <freebsd-scsi@freebsd.org>
Subject:   how to abort an ATIO/INOT
Message-ID:  <CAM0tzX1QkqmVpHR-DGp6Fj7i8DtgPhxXaT8SLH4Ondy05q36cg@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAM0tzX1QkqmVpHR-DGp6Fj7i8DtgPhxXaT8SLH4Ondy05q36cg>