Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion qla2x00t-32gbit/qla2x00-target/scst_qla2xxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,23 @@ static void sqa_qla2xxx_free_session(struct fc_port *fcport)
DECLARE_COMPLETION_ONSTACK(c);

fcport->unreg_done = &c;
scst_unregister_session(scst_sess, 1, sqa_free_session_done);
/*
* Use wait=0 (async) to avoid a severe stall under concurrent
* session teardown. With wait=1 the workqueue thread blocks
* inside scst_unregister_session() until
* scst_free_session_callback() fires. That callback cannot be
* scheduled until the TM thread processes SCST_UNREG_SESS_TM,
* but the TM thread is blocked on scst_mutex which the global
* management thread holds during concurrent session teardown
* (scst_sess_free_tgt_devs -> synchronize_rcu()). Under load
* this stall exceeds the hung-task timeout. With wait=0 the
* workqueue thread is released immediately; we wait only on
* fcport->unreg_done, signalled by sqa_free_session_done() at
* a point where scst_mutex is not held.
* See also: iscsi-scst session_free() which carries a similar
* warning.
*/
scst_unregister_session(scst_sess, 0, sqa_free_session_done);
wait_for_completion(&c);
}

Expand Down
Loading