From nobody Sun Oct 04 21:10:13 2026 X-Original-To: dev-commits-src-main@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 4hyZt25vpZz6jwqt for ; Sun, 04 Oct 2026 21:10:18 +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 4hyZt23H4Wz4g1R for ; Sun, 04 Oct 2026 21:10:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791148218; 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=ABD0PNt8TuandZ7vcoiCH58UZAfbeuTrwHAO4Hh6t4o=; b=RWfX8V2X/AuLMeuYjsCs3DJCHRZr45HHtCxpRPvVbSbqPYS/9NQj7M7+wjah5lJrOLaesh DJRmvVDkkXQ1hkOoXnZYzyjPX2iO15LEhwZ8eq5hM33TgODoi6qvu6dCNN5Gg/jqAkp8Nv 9Lrrl8zb7ubXH1pmNZyEa4tc7OfPXvNFSXStGNUBNj/aXLPCrjDAGY/z0c5HrylrkGd1Th K8Rc1fnsjdBmz8I9BXPka5pQn27w3pFOOHJrCVpFzbp9bTeOrPDpBRpxxM+w23iPk8PK9V QPk79yMCHvmF2XSAS10vY4nWsQhilJ4MSJWt3K/V4PckI2VjZPWnXb+HZX21NA== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1791148218; b=pRCwSDAa2D8d/9rcxx5pEUWCaQcxmjytLHmXSIACI6+k0PyyykGhI5ivGzvXe+9LrGFVE7 ZSreffkHDy2a3G84cxDybkhfARGGEEUrvB41ZU1zYoA7L5mMqqoTu8b98jKryqVTWPoFhT /tmWR47JU/g3iXhRbTVlI6fPHseJvaFWvvacLuA1PfWCONvKJuJyDCa3DdfEAp+vnpA40K 8pUkx9PXtQlZnRojuBi16ooqRgUqtstZsqP49CJak2W2th4t3oss3JWj00hTOeGpMQwJ62 LIBaUGLzZ+hi4hJ72MYr2trkwVC+jUn4ZLKyrIJDsVIOvX2dD73S3uIc7bWa0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791148218; 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=ABD0PNt8TuandZ7vcoiCH58UZAfbeuTrwHAO4Hh6t4o=; b=iOPdlF5V4T79dzOEIeM0GXdrcTZ8vCm96+nwmEFg8BTKPz/A3xPyFp/6up3+9X91AIDvS+ N5Nnc1PJFf2rFPm3eyNb5+1K0kGOSPiv8Ta9C3+3U3uLi6j0UC/jYExKpHTzt8GybR77ex Ejt89le0qx/btL3NtuB6QZ5cMRwAxslSkool+vBC0+RdWTu/68H42CjJ8jMaqKxk7goDVv iMnWjn3/G3AGExaGrhreUQsZlWrAtr4TIp4qOZw4KetY2vKay9ilOW5Bw26tM6EG4YGYDj ZjlTklvZ1ftj9qvmsX1LqiBOhszBKDusNdjd+uCRhQls68+oCr/eK7DqNQtl8w== 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 4hyZt21pyqzqcY for ; Sun, 04 Oct 2026 21:10:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 45c73 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 04 Oct 2026 21:10:13 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Vinicius Ferrao From: Rick Macklem Subject: git: 49bec8c3dc58 - main - clnt_vc.c: Fix handling of broken TCP connections List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: 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/main X-Git-Reftype: branch X-Git-Commit: 49bec8c3dc58cf8e944f9bbbbea07e7e856ad897 Auto-Submitted: auto-generated Date: Sun, 04 Oct 2026 21:10:13 +0000 Message-Id: <6ac2c0b5.45c73.167eeaac@gitrepo.freebsd.org> The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=49bec8c3dc58cf8e944f9bbbbea07e7e856ad897 commit 49bec8c3dc58cf8e944f9bbbbea07e7e856ad897 Author: Vinicius Ferrao AuthorDate: 2026-10-04 21:07:30 +0000 Commit: Rick Macklem CommitDate: 2026-10-04 21:07:30 +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. Reviewed by: rmacklem MFC after: 1 week Sponsored by: VersatusHPC --- 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); } /*