From nobody Tue Feb 21 23:33:59 2023 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 4PLwbW2Vp2z3tdQy; Tue, 21 Feb 2023 23:33:59 +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 4PLwbW1yThz4Tkk; Tue, 21 Feb 2023 23:33:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677022439; 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=79ImOHXuY+sRVsJWH73KN2Og5MYtSg6OkhmJ+i51o2I=; b=xowDgm2nHi/yU7qkJE5v32IM2kEgw+NSJX1UBJaANvciry+zZ8awYnLvEyCYtcaOEtwOBV jF4EtI3GugKT29uApwtph2mBqUEsUpFNwgVHqp+UCEbjnbLxv7u9zvUe1IuIfg0BdBYeeB fsS2tt3zegh5jsJLY+kOWlC3I0rmiQacpATjPoyOjMMDJlvy5uWx9WXywt9LU6tBdHccBT 69BlV18vsU+ji2cNX52DxPQ8WHKR1XERqszQTFzNjnPqqJ3WB2e2uyllyI9oWDXYJ3VJxO C80mgP5KKVY1I3yZOtSAvqr0OTHQY0SJ/+xX8brlt7hTmiIEL6cALQwiv0hV1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677022439; 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=79ImOHXuY+sRVsJWH73KN2Og5MYtSg6OkhmJ+i51o2I=; b=BlByCUhAaPt6/Hlvphmqk9Rye8P8Dbq2C1/LmL29DAi/wd/KtXQubFVClwYaEuRA3b7fcV zwP8dcWjG35S5p2MTY+bng+ggi1xwYFEK56HF+GM2FvCSBZIgqX9E8VWcx72yIO6KhVjPw cMWIAliDiMx9ycItODTOA0rcCQnrPReNd3Cq1iebls7BCPtPgsbxehxSND2pSoq8xPd3Tq dci0vawWeF0Jr02YAdRb/6eV+pF+0Dox01DO68ucXSu3MQZ6vNKh0MVvrPpHtT+y2TAe2h KXGV7RktAJzMR7eZf4RxGek4YzBntCAoLsjb+FV4VfKYnm4lDg5ItDyaVkJtsw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677022439; a=rsa-sha256; cv=none; b=rKvGQlYMwScqwfTt1AgceX0OHhBE95JSM4ASeuysnwClj7mPzN/BgP2KlIPbZSjtvrJ6r3 dN+fM0Vvlftdo0wFLzmDqp7RdBAoHBO9CQlYXRSbKAexPa4RIeSCPt7NFNbCdy+tzJa6LR Jb9qSC9/wNoC6xRr1ntbx2pq7yklTqxoGL79Vff2wLM+F+TRGPU3yZBIQckGr1VXRc6sPN NQLf1tW+BM8fbqNYjz5qddQ5axWZ28q9KxmScIflzFq9qbwdGoBXT7yG5utYgjnuy/jeYE hn3LxmYGN0c4StDZ6lKfrMMfnuW7SBZOG/n5UZVQXvn8lTgDrltAiBVk4TVnZw== 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 4PLwbW10rjzf4W; Tue, 21 Feb 2023 23:33:59 +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 31LNXxMa039420; Tue, 21 Feb 2023 23:33:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31LNXxGE039419; Tue, 21 Feb 2023 23:33:59 GMT (envelope-from git) Date: Tue, 21 Feb 2023 23:33:59 GMT Message-Id: <202302212333.31LNXxGE039419@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 335517b9b02b - stable/13 - nfscl: Fix interaction between mmap'd and VOP_WRITE file updates 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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/13 X-Git-Reftype: branch X-Git-Commit: 335517b9b02bc37f4d532998dc8e3ce5757cdef6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=335517b9b02bc37f4d532998dc8e3ce5757cdef6 commit 335517b9b02bc37f4d532998dc8e3ce5757cdef6 Author: Rick Macklem AuthorDate: 2023-02-08 22:25:01 +0000 Commit: Rick Macklem CommitDate: 2023-02-21 23:32:40 +0000 nfscl: Fix interaction between mmap'd and VOP_WRITE file updates asomers@ found a problem with the NFS client, where a write to an NFS mounted file done via mmap(2) was lost when fspacectl(2) was done before it. This turned out to be caused by clearing the dirty bit on pages when the client was doing commit RPCs, due to the second argument to vfs_busy_pages() being set to 1. Commit RPCs tell the server to commit previously written data to stable storage. However, Commit RPCs do not write data from the client to the server. As such, if the dirty bit on the page has been set by a mmap'd write to an address in the page, it should not be cleared. Clearing it causes the mmap'd write to by lost. This patch fixes the problem by changing the 2nd argument to vfs_busy_pages() to 0 for this case. I doubt this bug has affected many, since it was inherited from the old NFS client and was in 4.3 FreeBSD twenty years ago. Although fspacectl(2) is FreeBSD 14 specific, a write(2) would cause the same failure. PR: 269328 (cherry picked from commit 847967bc4e198a258b030a5864e64e029e7452e5) --- sys/fs/nfsclient/nfs_clvnops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index 02e5e3540d72..d1d84b05bbd7 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -3023,7 +3023,7 @@ again: wcred = bp->b_wcred; else if (wcred != bp->b_wcred) wcred = NOCRED; - vfs_busy_pages(bp, 1); + vfs_busy_pages(bp, 0); BO_LOCK(bo); /*