From nobody Tue Jul 30 14:29:20 2024 X-Original-To: dev-commits-src-all@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 4WYHfn1KFtz5S4Fc; Tue, 30 Jul 2024 14:29:21 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WYHfm53Qgz4yq6; Tue, 30 Jul 2024 14:29:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722349760; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dHJTV+OCPmJA8aJSOpYqCVkPhBX3VcCbiMfgHxrvAOU=; b=F+O59K6R5mexqGxuOd5kcuSc0ThpMbs+yWXoOnTKDOItY8XSmTKPPvlWppOJxtnxBEwlHY kP64RCf9vAUWM5TY6BaDWeXHn/QJbfIrXTx/P3YPbhPDuG7Edbea0HUcD9irxla/fD18jv 1H2dl7Uw/XuRnEc37CEzOGxk7Anq0VA+ABORNxTK53x1It9YD7tL17dDzGHhG9XGqJMwWn vbywpNIovVQPDL3BASwH/+/ZF8Hym234eTd+8UHCjEYWR0pkLiJRQ8YwC00sL6pRUwe6Tv GQwgKqCDeTM51efq9KoyuegAMdnBZmXDpU4NWzuvqyf8LGDWdmvlIoaD0FVHzA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722349760; a=rsa-sha256; cv=none; b=CzAtJY5sgn+D4CaMG8kd/16mwKsNHvUuql95OB9WTTEp4A/J6NfkITBEX14HSHRhLrGBLG PFVdwCfWuq2ojnO4QNbs6WE6NoQ19X3CkOpyckLwGh4ZUj5UXTKogtAQ9eizlLIwR8CI0I thFJvAFMOzPnFqVN2B5stn//9ylb02R4aPG4BgcRrSDyfOubi2Z6h0NTQklYzqINXYDFve 8KL7AMWGtZAhQnGS3L4xUV9DSqHgdUljv/q0LiWDpjpVzPVcGqtrm83RUsK+zPjR8aphpx XG+YjnqF9cxqv7R7xjQ0CDVNsN53IqpnOKcheeriubKpiHsvJc0IfVKD7i2j0A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722349760; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dHJTV+OCPmJA8aJSOpYqCVkPhBX3VcCbiMfgHxrvAOU=; b=prRDskvzzwOYQfvjkabUod+ZdCn8Go4cgowGQTpSlDU0wBSNLtzTDPId3q4hx5mu/66gis aFBxKic7Z3Tnnc+HoSKUCumQ4F4FNe3aZNuv0I9emNBLhMtDFyqwTJ+1/rWEB1KVrXtV+p zsCAyV5PpHhn2Iva8gG32EoTxZxDWOaAUiSvh6MZS0Vt29tsoXEDwuYpcyU/+rEwZ7/hsD z6T/u9bOUV8ySWsq+vuAAPRlB0Wd1iYvkXvpQQ+mszazN5Qf2yWojjgnvFX//UWu81sdZp JnaxByPNPQ0De8MlcilkFN9zx5DTy24jrzLJv4/vcTwyXRiBcNoEcidd5aj2Yw== 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 4WYHfm4h3pzLND; Tue, 30 Jul 2024 14:29:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46UETKDc029668; Tue, 30 Jul 2024 14:29:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46UETKNq029665; Tue, 30 Jul 2024 14:29:20 GMT (envelope-from git) Date: Tue, 30 Jul 2024 14:29:20 GMT Message-Id: <202407301429.46UETKNq029665@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 19c15e41c6cd - main - nvmf_tcp: Update R2T accounting stats when aborting command buffers List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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/main X-Git-Reftype: branch X-Git-Commit: 19c15e41c6cdf7bb5abd89ff0ebd11c620409256 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=19c15e41c6cdf7bb5abd89ff0ebd11c620409256 commit 19c15e41c6cdf7bb5abd89ff0ebd11c620409256 Author: John Baldwin AuthorDate: 2024-07-30 14:28:19 +0000 Commit: John Baldwin CommitDate: 2024-07-30 14:28:19 +0000 nvmf_tcp: Update R2T accounting stats when aborting command buffers If a queue pair is destroyed (e.g. due to the TCP connection dropping) while a host to controller data transfer is in progress, the pending_r2ts counter can be non-zero. This can later trigger an assertion failure when the capsule is freed. To fix, update the relevant R2T accounting stats when aborting active command buffers during queue pair destruction. Sponsored by: Chelsio Communications --- sys/dev/nvmf/nvmf_tcp.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/dev/nvmf/nvmf_tcp.c b/sys/dev/nvmf/nvmf_tcp.c index 80c75e02c9b5..135c9968d8eb 100644 --- a/sys/dev/nvmf/nvmf_tcp.c +++ b/sys/dev/nvmf/nvmf_tcp.c @@ -1553,6 +1553,7 @@ tcp_free_qpair(struct nvmf_qpair *nq) for (u_int i = 0; i < qp->num_ttags; i++) { cb = qp->open_ttags[i]; if (cb != NULL) { + cb->tc->active_r2ts--; cb->error = ECONNABORTED; tcp_release_command_buffer(cb); } @@ -1564,6 +1565,10 @@ tcp_free_qpair(struct nvmf_qpair *nq) TAILQ_FOREACH_SAFE(cb, &qp->rx_buffers.head, link, ncb) { tcp_remove_command_buffer(&qp->rx_buffers, cb); mtx_unlock(&qp->rx_buffers.lock); +#ifdef INVARIANTS + if (cb->tc != NULL) + cb->tc->pending_r2ts--; +#endif cb->error = ECONNABORTED; tcp_release_command_buffer(cb); mtx_lock(&qp->rx_buffers.lock);