From nobody Fri Oct 29 23:58:48 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9AF46181E68D; Fri, 29 Oct 2021 23:58:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgzsq3JjRz4Vt8; Fri, 29 Oct 2021 23:58:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D27B1FFDE; Fri, 29 Oct 2021 23:58:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNwmgh004254; Fri, 29 Oct 2021 23:58:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNwmwZ004253; Fri, 29 Oct 2021 23:58:48 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:48 GMT Message-Id: <202110292358.19TNwmwZ004253@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: b2f1beeeff10 - stable/13 - iscsi: Abort data-out tasks queued on a terminating session. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b2f1beeeff10e24b4da21f6d97a88f70163c7bf0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=b2f1beeeff10e24b4da21f6d97a88f70163c7bf0 commit b2f1beeeff10e24b4da21f6d97a88f70163c7bf0 Author: John Baldwin AuthorDate: 2021-09-15 20:25:30 +0000 Commit: John Baldwin CommitDate: 2021-10-29 23:43:48 +0000 iscsi: Abort data-out tasks queued on a terminating session. cfiscsi_datamove_out() can race with cfiscsi_session_terminate_tasks() and enqueue a new task after the latter function has aborted existing tasks. This could result in a deadlock as cfiscsi_session_terminate_tasks() waited forever for this task to complete. Reviewed by: mav Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D31892 (cherry picked from commit 0cd6e85e242bb07a33df9a6314e90bcb0ba99576) --- sys/cam/ctl/ctl_frontend_iscsi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c index ac94a786a701..b8ab25e89eb9 100644 --- a/sys/cam/ctl/ctl_frontend_iscsi.c +++ b/sys/cam/ctl/ctl_frontend_iscsi.c @@ -2783,6 +2783,11 @@ 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) { + CFISCSI_SESSION_UNLOCK(cs); + cfiscsi_data_wait_abort(cs, cdw, 44); + return; + } TAILQ_INSERT_TAIL(&cs->cs_waiting_for_data_out, cdw, cdw_next); CFISCSI_SESSION_UNLOCK(cs);