From nobody Sun Oct 11 03:09:05 2026 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 4j2QYL354zz6wJJy for ; Sun, 11 Oct 2026 03:09:10 +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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4j2QYL2bTSz4N0h for ; Sun, 11 Oct 2026 03:09:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791688150; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3FGcG6ratnPDe6o7+JNLwOTfbTHnrhRB0NDu+t+gWkk=; b=cUmMuyCBiEHLKYOLiMkqM7h4mnVExhyAOnVatEMKG+3yPTC0cg3N4Su3M+TT+aThjk1fQ4 ozdvtwzBfEpo6QDQhxZun0pKqu8ezHrJ3d/io4eXAznMVUAlaQd0zsdcwUSv0Ffuw/KDqI 1KHg4m2Y592vlcfMxBXgFVkh2+USX3kPzSQvcK1E9WZZKQiR2T8lF7/QAm6e55NdHLjjAk cCw1Yu/9RJnDa7J2vRykfR43/wQpuAqvqciWsHGz+eEcLHeSCjsOjp85SFmqRy/5NETbr2 S4zQEsoGe8heYpCF40ecnk6k3uqRqcT8Tf5Xjybi+dAIhN9TNYqgatLa80vt7w== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1791688150; b=SjaCyy7FAIFRrJ9r5j4zlOkDP3Gf/AgCidmspV6RZbhyzvFZyXCokU3zZsau8HRtIEbVXt kxrBBwQK2O+BPrjsaKDvc72DtN98aABO++euBsrEizEXQJ+30byek1NSADOo9CDSz20g1D 3oKP1umPauEIFQPNkVUiJwByUxkiZrcm7zbJMAvdlTv3+5e8QgM+0fJhisdif5Sl9sNFJL ehhmYhcctcTSmd2F9PvzDl+Uw04mE70cNGkz/jU95LxS3SL3ym6xLcRy6BQ6ljPqhWnNcD 7bC0+U09R9d8zQ0uujL7BTznaBYNtij+yhLSXRTJkaZ+N8fds9QHeJ/KXBD9Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791688150; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3FGcG6ratnPDe6o7+JNLwOTfbTHnrhRB0NDu+t+gWkk=; b=fQ8mNFAFM8t3SGs+t0PrkRlS2FOZHTvue47VLx+XImx+h+l1CPhI3ruDP/u+9bIlfyYb1O Mwu46T/U7oRCjfaaAIr804I2UdGMqRsK2zAi+4gu1uIquCY86TuxU6BBkA5aipnQPXr8vP DcPtUEtCKbWyNyprCHrBlrjqxak+OztfCpR7agiueFHEHwzYVhZXSML+68200nvDRNQBk1 Wpp6i98DKMsChSA3Z3UjQz+hZvKnEJfK1g4P9879Yafxz5fOJy/jaTgdj71no2BeVo0C8y nppKLnxxIjDjJZRqaMY2mCubCrHwbfu6BRdFQspGWVVVydgfkNeV8UjiqC/d1w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4j2QYL1fKGzMpV for ; Sun, 11 Oct 2026 03:09:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 408f5 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 11 Oct 2026 03:09:05 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Vinicius Ferrao From: Rick Macklem Subject: git: 07c057b5de44 - stable/14 - clnt_vc.c: Fix handling of broken TCP connections List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 07c057b5de44e993fb445e70a9e2f77b30b83867 Auto-Submitted: auto-generated Date: Sun, 11 Oct 2026 03:09:05 +0000 Message-Id: <6acafdd1.408f5.16b9ca16@gitrepo.freebsd.org> The branch stable/14 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=07c057b5de44e993fb445e70a9e2f77b30b83867 commit 07c057b5de44e993fb445e70a9e2f77b30b83867 Author: Vinicius Ferrao AuthorDate: 2026-10-04 21:07:30 +0000 Commit: Rick Macklem CommitDate: 2026-10-11 03:07:05 +0000 clnt_vc.c: Fix handling of broken TCP connections After more than, I don't know, maybe 10k operations: mount, copy, remove, verify and unmount cycles, one cp command hung in close() / ncl_flush and never recovered. The machine and the mount continued to work normally through a new connection, but the writes using the old connection stayed frozen. I did not understand exactly what happened. I traced what appears to be the issue in the code. My current understanding is that clnt_vc_soupcall() saw the EOF and woke the caller waiting for RPC replies, but one caller remained blocked in sosend(). That thread continued holding a reference to the old client, preventing it from being completely cleaned up. The attached patch calls socantsendmore() when EOF is received, which should wake the blocked sender and let the normal reconnect code replace the connection. (cherry picked from commit 49bec8c3dc58cf8e944f9bbbbea07e7e856ad897) --- sys/rpc/clnt_vc.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/rpc/clnt_vc.c b/sys/rpc/clnt_vc.c index 03fb27e8be36..dbd42b04c63d 100644 --- a/sys/rpc/clnt_vc.c +++ b/sys/rpc/clnt_vc.c @@ -980,11 +980,8 @@ clnt_vc_soupcall(struct socket *so, void *arg, int waitflag) mtx_unlock(&ct->ct_lock); /* - * If another thread is already here, it must be in - * soreceive(), so just return to avoid races with it. - * ct_upcallrefs is protected by the SOCKBUF_LOCK(), - * which is held in this function, except when - * soreceive() is called. + * ct_upcallrefs prevents another upcall from processing the + * socket while the receive buffer lock is dropped. */ if (ct->ct_upcallrefs > 0) return (SU_OK); @@ -1025,6 +1022,11 @@ clnt_vc_soupcall(struct socket *so, void *arg, int waitflag) * to read from the stream. */ error = ECONNRESET; + + /* Avoid reversing the so_snd -> so_rcv lock order. */ + SOCK_RECVBUF_UNLOCK(so); + socantsendmore(so); + SOCK_RECVBUF_LOCK(so); } /*