From nobody Sun Oct 11 02:56:51 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 4j2QHF1g6Vz6wHVq for ; Sun, 11 Oct 2026 02:56:57 +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 4j2QHD6QjXz4L6T for ; Sun, 11 Oct 2026 02:56:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791687416; 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=ekUzqux4Uo4XHOxgLAv1e++3PVJVEX7UQSBZVFiRZsw=; b=LHLDnQNDZ9EJHw9swjvbTHu1VOq7onyxx0g/C8hUWJrF+WMXmkZz6iwZYTnO61auGMq1cK Xk9OjlvVKyKvEv8DIsspKoBzcY1RjaffpE59nhHo7HvLu1jWw4BMUrszskOjjbsgBlrNnL TKzwHn/g1jiJwrITspypDL+fUECM7NXc3AD+TqPj6HAS7OYm/fmUL7BPKc8pKSgcKyQ4hc 59GqnNm1Vzqi9kSYvtxgkFjqpEj56dbqbCDtK6pSqxv7zqYQ8FvC3otSFjrMG2dVDQFxM1 xFIJVlLGM4hXdrPRKv9N4XtG9U+wDcYFkBnMZvwH+ugJ9VCaOU8v760w27qfDg== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1791687416; b=dnIgtbmJ9ZBk/ewz8dOPj4lHfUNU3CH9osG1NxucmCMXg87biRkgZa20R8DCAU2h/8KJtU vPIA+EtnXBccik1hgsAuFYkGj/87RPo+NNuai4M59OaPI4b5o/Wp9X/wyBwKQumhI17zUR TeF8gwc607faZghu8m5W+cJAvrFy3fldoq+M0irsJtv1PBoZUirPAsMbBQmA/1vcmYr2V3 yxQlMCG+qlMzoXOruIEXYqgsmlvAbwZGJJ2G7AtHw64mIoOSUSIxJlGAtCsaf1vghvJGCC jwHGN+U9Cq2Fb+XBxGqLwdZ+RjuBowM4S3XxKLCdiQroMItXC3kSm5ApP4vFRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791687416; 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=ekUzqux4Uo4XHOxgLAv1e++3PVJVEX7UQSBZVFiRZsw=; b=Ff7sjnxBdzlNTcScrSVENfQjKq4kAgP3xXL4Ag1H6G8nJNDbjzejzQ2y9Yxgny0TtVRpBg ZB216QU/nXZ1sf96BI3NjNnF+4GB5TggoLeedGhibZyT2cemqb+S//C8+3/Y9haC+uyE6g rW3GysWSn/oyrkxFRg9rWVf/OC96cBadRMTcr1/SES2sv6IJI4s9CxtN2tzNUzy0KD36DF pB1TwY/Diwc1QrZo4iGyQaBTo4zGnsbkXAkje2oBeIphfUsH3IxXp6yZxUM4v+Atm+waTU Z3rSmWt32sDfDG3VoPXxQ6vvlBrsUg9dDR8c0XwdoHJwu4v3fdtZrzNfXXosJw== 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 4j2QHD5WJgzMCZ for ; Sun, 11 Oct 2026 02:56:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3f822 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 11 Oct 2026 02:56:51 +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: 69dc3d97a3c6 - stable/15 - 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/15 X-Git-Reftype: branch X-Git-Commit: 69dc3d97a3c6385334d7056e8c9d63238c7033a9 Auto-Submitted: auto-generated Date: Sun, 11 Oct 2026 02:56:51 +0000 Message-Id: <6acafaf3.3f822.47ef8f8d@gitrepo.freebsd.org> The branch stable/15 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=69dc3d97a3c6385334d7056e8c9d63238c7033a9 commit 69dc3d97a3c6385334d7056e8c9d63238c7033a9 Author: Vinicius Ferrao AuthorDate: 2026-10-04 21:07:30 +0000 Commit: Rick Macklem CommitDate: 2026-10-11 02:54:38 +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 9b12212f9a2e..f7dfe34a8b4a 100644 --- a/sys/rpc/clnt_vc.c +++ b/sys/rpc/clnt_vc.c @@ -964,11 +964,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 socket receive buffer 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); @@ -1009,6 +1006,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); } /*