From nobody Thu Apr 11 20:31:39 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 4VFrvb1sBKz5G416; Thu, 11 Apr 2024 20:31:39 +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 4VFrvb1J4vz4qr7; Thu, 11 Apr 2024 20:31:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712867499; 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=tXQJslu1m/VNWm0g0pmyoRkCg99biwbwxFXYeJQICOc=; b=Ulw/F8xuQISL3kpCBu6HMY/s/WbRnUEyi8ia3G0hE2790rYIchoBJHt6hxpTsDDlOjskN0 4cPhBS9vbd2UkK5FLfCNKKRJRmZm68aM5l/jKVcy3Z7fvCLtOmGTBpIHGczFwvmFYK93/W rUSknP0LSCV10bkODMbRCLOipY3mVpchKUj2QMJl12E3pgyKkqfSLKFUzK8Nb/DwVrCIfK 6cTZ86pL9ovUpaCC4udFTh+ciwwFKNOsHUyY66RGtBxjJWyY2iYz3wwoRAW5NNocFZNvkM XHIGfLxPz5cEAKI7/wj8S01lLeJIBTpnqMe4GnUJT9hWt1hQSLbEXr51Yf+dDg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1712867499; a=rsa-sha256; cv=none; b=hvve9ce0Lhp38FYJiWytCX4zl/gPXItV5P5Eek1u8bVp0K5NhrkkqYLzEFT5+wgHRPmsnc gmpNY5FvP31zh75qnG+X5GthX5K5lTP68c5LMXp3i83NDTxs5LRCXGPDH8Lrfu9S8Z1le+ TLIhXMih9x/qfDTV1iWK4xrg8j4x7P6SfdmaeknszbHn6HgcyfrEuel8YeCEdFW/4GbFe0 EgAUBxx9apjmWicfyzC/BN3zPTGj0PxZMp8ywZkNGGScGHF3TtRi3dhcpNM6tbMULDUyeu Q+NSR+qIRIMkaTrnEZ/XVVnSBxxPoz989Md0M5uUnKLHtmir/vEfceAPxxvReg== 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=1712867499; 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=tXQJslu1m/VNWm0g0pmyoRkCg99biwbwxFXYeJQICOc=; b=b8nd5v5GkfxKkFJVIILRojWkF4toym3ipyZEV+DqYD2jAFYVqa9AuiyU5jpZs/5SOTPmxI pOnSpPxtnBmnPO2IZ11Ko0ZjsgIV7oe8yusfmQz2IfSQunk23KSm1HaKd/O2bU0qaYpCsl KruL3ghk87h/J8F3xftuxGIrQQz/BiV5AA/JfI9AP5EykE+VmMT+ycwKzrn/tQNRsRNggj FF9aRwgWS/IM/owQ2cGfJ73aFgVARQ0cKIy92KlMWRtaGyZ53WPw/rvrppmDdRY9rHpqIK ix7RNN6F9wxI9j3ud2LH1B5eG/FhCokbLqmasYU82e+TmTwvYVfeAV5cdAaSoQ== 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 4VFrvb0vZhzL4J; Thu, 11 Apr 2024 20:31:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43BKVdOT071753; Thu, 11 Apr 2024 20:31:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43BKVdxW071750; Thu, 11 Apr 2024 20:31:39 GMT (envelope-from git) Date: Thu, 11 Apr 2024 20:31:39 GMT Message-Id: <202404112031.43BKVdxW071750@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: d00c64bb2347 - main - nfscl: Purge name cache when readdir_plus is done 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: dev-commits-src-all+owner@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/main X-Git-Reftype: branch X-Git-Commit: d00c64bb2347cc620d31a178c7755aa7e594f065 Auto-Submitted: auto-generated The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=d00c64bb2347cc620d31a178c7755aa7e594f065 commit d00c64bb2347cc620d31a178c7755aa7e594f065 Author: Zaphrod Beeblebrox AuthorDate: 2024-04-11 20:27:27 +0000 Commit: Rick Macklem CommitDate: 2024-04-11 20:27:27 +0000 nfscl: Purge name cache when readdir_plus is done The author reported that this patch was needed to avoid crashes on a fairly busy RISC-V system. The author did not provide details w.r.t. the crashes. Although I have not seen any such crash, the patch looks reasonable and I have not found any regressions when testing it. Since "rdirplus" is not a default option, the patch is only needed if you are doing NFS mounts with the "rdirplus" mount option and seeing crashes related to the name cache. MFC after: 1 week --- sys/fs/nfsclient/nfs_clvnops.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index 0b8c587a542c..85c0ebd7a10f 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -2459,6 +2459,16 @@ nfs_readdir(struct vop_readdir_args *ap) return (EINVAL); uio->uio_resid -= left; + /* + * For readdirplus, if starting to read the directory, + * purge the name cache, since it will be reloaded by + * this directory read. + * This removes potentially stale name cache entries. + */ + if (uio->uio_offset == 0 && + (VFSTONFS(vp->v_mount)->nm_flag & NFSMNT_RDIRPLUS) != 0) + cache_purge(vp); + /* * Call ncl_bioread() to do the real work. */