Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Apr 2022 23:12:34 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 6a435d581fe2 - stable/13 - iscsi: Abort fewer data-out tasks on a terminating session.
Message-ID:  <202204292312.23TNCYta044822@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=6a435d581fe2e7e1d0f05bc402ac5063898526f7

commit 6a435d581fe2e7e1d0f05bc402ac5063898526f7
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-01-18 17:28:43 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-04-29 22:55:32 +0000

    iscsi: Abort fewer data-out tasks on a terminating session.
    
    Only abort tasks queued for datamove after
    cfiscsi_sesssion_terminate_tasks has posted its internal
    CTL_TASK_I_T_NEXUS_RESET task.
    
    Reported by:    Jithesh Arakkan @ Chelsio
    Reviewed by:    mav
    Fixes:          0cd6e85e242b iscsi: Abort data-out tasks queued on a terminating session.
    Sponsored by:   Chelsio Communications
    Differential Revision:  https://reviews.freebsd.org/D33747
    
    (cherry picked from commit a3af69fa81d2341a3864edc67419de3b3bad77d9)
---
 sys/cam/ctl/ctl_frontend_iscsi.c | 7 ++++++-
 sys/cam/ctl/ctl_frontend_iscsi.h | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c
index b8ab25e89eb9..6e3505c86199 100644
--- a/sys/cam/ctl/ctl_frontend_iscsi.c
+++ b/sys/cam/ctl/ctl_frontend_iscsi.c
@@ -1155,6 +1155,7 @@ cfiscsi_session_terminate_tasks(struct cfiscsi_session *cs)
 	}
 
 	CFISCSI_SESSION_LOCK(cs);
+	cs->cs_terminating_tasks = true;
 	while ((cdw = TAILQ_FIRST(&cs->cs_waiting_for_data_out)) != NULL) {
 		TAILQ_REMOVE(&cs->cs_waiting_for_data_out, cdw, cdw_next);
 		CFISCSI_SESSION_UNLOCK(cs);
@@ -2783,8 +2784,12 @@ cfiscsi_datamove_out(union ctl_io *io)
 	cdw->cdw_r2t_end = io->scsiio.ext_data_filled + r2t_len;
 
 	CFISCSI_SESSION_LOCK(cs);
-	if (cs->cs_terminating) {
+	if (cs->cs_terminating_tasks) {
 		CFISCSI_SESSION_UNLOCK(cs);
+		KASSERT((io->io_hdr.flags & CTL_FLAG_ABORT) != 0,
+		    ("%s: I/O request %p on termating session %p not aborted",
+		    __func__, io, cs));
+		CFISCSI_SESSION_WARN(cs, "aborting data_wait for aborted I/O");
 		cfiscsi_data_wait_abort(cs, cdw, 44);
 		return;
 	}
diff --git a/sys/cam/ctl/ctl_frontend_iscsi.h b/sys/cam/ctl/ctl_frontend_iscsi.h
index 7c7f422a8d1f..165f0ad79d70 100644
--- a/sys/cam/ctl/ctl_frontend_iscsi.h
+++ b/sys/cam/ctl/ctl_frontend_iscsi.h
@@ -84,6 +84,7 @@ struct cfiscsi_session {
 	int				cs_timeout;
 	struct cv			cs_maintenance_cv;
 	bool				cs_terminating;
+	bool				cs_terminating_tasks;
 	bool				cs_handoff_in_progress;
 	bool				cs_tasks_aborted;
 	int				cs_max_burst_length;



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