aboutsummaryrefslogtreecommitdiff
path: root/sys/cam/ctl/ctl_frontend_iscsi.c
diff options
context:
space:
mode:
authorEdward Tomasz Napierala <trasz@FreeBSD.org>2017-10-04 11:35:04 +0000
committerEdward Tomasz Napierala <trasz@FreeBSD.org>2017-10-04 11:35:04 +0000
commit5b4bc31eeeaf8d16e3e2ffa811833524555fc3c4 (patch)
tree828722552bcb226d3441453c15d6d81c2e29b286 /sys/cam/ctl/ctl_frontend_iscsi.c
parent9eba44bf468c0994006b2bd9f939de84043fc973 (diff)
downloadsrc-5b4bc31eeeaf8d16e3e2ffa811833524555fc3c4.tar.gz
src-5b4bc31eeeaf8d16e3e2ffa811833524555fc3c4.zip
Fix iSCSI target panics on concurrent session teardown and display
(eg removing a target and doing "ctladm islist -v" at the same time). Reviewed by: manu Tested by: manu MFC after: 2 weeks Sponsored by: DARPA, AFRL
Notes
Notes: svn path=/head/; revision=324261
Diffstat (limited to 'sys/cam/ctl/ctl_frontend_iscsi.c')
-rw-r--r--sys/cam/ctl/ctl_frontend_iscsi.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c
index 24fcbdf6933e..eb10603254c2 100644
--- a/sys/cam/ctl/ctl_frontend_iscsi.c
+++ b/sys/cam/ctl/ctl_frontend_iscsi.c
@@ -1308,18 +1308,17 @@ cfiscsi_session_delete(struct cfiscsi_session *cs)
KASSERT(TAILQ_EMPTY(&cs->cs_waiting_for_data_out),
("destroying session with non-empty queue"));
+ mtx_lock(&softc->lock);
+ TAILQ_REMOVE(&softc->sessions, cs, cs_next);
+ mtx_unlock(&softc->lock);
+
cfiscsi_session_unregister_initiator(cs);
if (cs->cs_target != NULL)
cfiscsi_target_release(cs->cs_target);
icl_conn_close(cs->cs_conn);
icl_conn_free(cs->cs_conn);
-
- mtx_lock(&softc->lock);
- TAILQ_REMOVE(&softc->sessions, cs, cs_next);
- cv_signal(&softc->sessions_cv);
- mtx_unlock(&softc->lock);
-
free(cs, M_CFISCSI);
+ cv_signal(&softc->sessions_cv);
}
static int