On 3/18/2014 10:28 PM, Nicholas A. Bellinger wrote: > On Tue, 2014-03-18 at 10:43 -0700, Alex Leung wrote: > > So, as far as existing code is concerned this is in fact correct. > > The reason is because all fabric drivers that require an ACK (eg: > everything except tcm_loop + vhost-scsi) are passing TARGET_SCF_ACK_KREF > into this codepath. This makes the above target_put_sess_cmd() not the > last kref_put for those callers, and another target_put_sess_cmd() is > required (usually via transport_generic_free_cmd) once the fabric ACK > has been received in order to release the descriptor. > > This done in order to avoid a race between the posting of a response -> > accounting of se_cmd in transport_cmd_check_stop(), and the reception of > a ACK -> transport_generic_free_cmd() -> final target_put_sess_cmd() > occurring before transport_cmd_check_stop() has finished processing. > > So what your code needs to do is pass TARGET_SCF_ACK_KREF into both > target_submit_cmd() + target_submit_tmr(), and TFO->check_stop_free() > needs to call target_put_sess_cmd(). > > This will follow what all other HW fabric drivers are currently doing. > This is extremely helpful. Thanks for the explanation. Alex -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html