From nobody Wed Jan 17 10:04:20 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 4TFM111m6nz57Tm9; Wed, 17 Jan 2024 10:04:21 +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 4TFM111JPnz4XRP; Wed, 17 Jan 2024 10:04:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705485861; 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=qhOzcoAGQhAybiqAkNHLYtmiTDy2a6Fo+57cjVj9Zvo=; b=w6DwAACoWHL/YSofBTV9yiCmxmr8l50gE9niQ5FacW/RYsZ1ESE3JkvGWJK7/DnPsRUE7f Z5VqO4ikI1pb4AK9ZAYyNcemOr7GVyznELfO1t+ZKtA9dGQAlUAFzNI2+Nga5lCDwwsslr pepl7jNUWBay1UMVoh07CN8595PhQmUJR72x6jqaIoTg64W5BI1nouuGt3WssQhv+11JAb l2nMFfeIr4OnLsgXW5nAJMpOyT6jNhTGzC1O5r27NweSPL3Yw2NLkjQzzuNGXcMnXvAoRC l9Gm+dvlP4irQknsAU3c3X4IvZOYpGZyEc4PUFD3FeT+vnJ6DHMtdfv4NA5sAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705485861; 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=qhOzcoAGQhAybiqAkNHLYtmiTDy2a6Fo+57cjVj9Zvo=; b=AnswCAb1HNSz/7RRUDwAeTfqZFfUZzGBndSzorycXNw4giLwcbY9of48TxeSSUo+/UE03V 2kWc5xvqxL1HLhWkldJV7NUEUu58rA6RVoIgvCVcl7uH1QLgau+rMSIZzxV2eywGPdhwuW tCXvRcHy9M+5u+ojiUONModKePHQWDMjzpdF72MFWKSHXRXKXiWhEfcRQTPfiLL4Gi7Cp5 C1q1kiUlZXaudKzEeZ/Esl5Y25FgDKLcZAigACIs1whCsDCAGF//DTICz43E4SG6xOsW7/ Ow1++btmRxJ2VXcHxB2f3wq70GbwgBQH4NK+ysaOoZyhy6wtr7sonpwzzsyjTg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1705485861; a=rsa-sha256; cv=none; b=cI3JWqA7msy+JQycScCH4nmWROhxVg8EhzNqF7fngfZY4PU9nBCSonZFT1FtF1nexf+4bI y73wsIf5Ct23orpi1kf5oW17+06m/cIKSv2m8r/UQQ8iq9EntZ9qw+QsPyWjFiIwOHNGE+ Y9r6H8TITL1rD+sDTI1xN1t9I94keTBy+VEo1VaEwqKRhZ4REH/2twSh/5IAFOMpeBkkxr PBgbMfZUV1E8kYxQiDnSy9Tw6+f3qLhM4V7zT30im9OCFn39C8ktcaLZnHMa6SH1nDh8Od yT17JuOMwGWLm9npUkeTzlbX6ZHpPHwmDYg/iqmTyYpWtAyxZCcdDrgnGxyCSA== 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 4TFM110GRlzK4C; Wed, 17 Jan 2024 10:04:21 +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 40HA4KHY022927; Wed, 17 Jan 2024 10:04:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40HA4KRa022924; Wed, 17 Jan 2024 10:04:20 GMT (envelope-from git) Date: Wed, 17 Jan 2024 10:04:20 GMT Message-Id: <202401171004.40HA4KRa022924@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 7b49e60227f8 - stable/14 - ncl_bioread(): check for vp->v_object before accessing it 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 7b49e60227f837c9a54c8bfdacd2b352b7e1ded9 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7b49e60227f837c9a54c8bfdacd2b352b7e1ded9 commit 7b49e60227f837c9a54c8bfdacd2b352b7e1ded9 Author: Konstantin Belousov AuthorDate: 2024-01-15 11:49:14 +0000 Commit: Konstantin Belousov CommitDate: 2024-01-17 10:03:51 +0000 ncl_bioread(): check for vp->v_object before accessing it (cherry picked from commit 503f72a828c7d0d938ec73ffbf62406038c69d47) --- sys/fs/nfsclient/nfs_clbio.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clbio.c b/sys/fs/nfsclient/nfs_clbio.c index 7b9b68782d53..f6b8cc0a70a4 100644 --- a/sys/fs/nfsclient/nfs_clbio.c +++ b/sys/fs/nfsclient/nfs_clbio.c @@ -417,6 +417,18 @@ out: return (error); } +static bool +ncl_bioread_dora(struct vnode *vp) +{ + vm_object_t obj; + + obj = vp->v_object; + if (obj == NULL) + return (true); + return (!vm_object_mightbedirty(vp->v_object) && + vp->v_object->un_pager.vnp.writemappings == 0); +} + /* * Vnode op for read using bio */ @@ -489,9 +501,7 @@ ncl_bioread(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred) * unlocked read by nfsiod could obliterate changes * done by userspace. */ - if (nmp->nm_readahead > 0 && - !vm_object_mightbedirty(vp->v_object) && - vp->v_object->un_pager.vnp.writemappings == 0) { + if (nmp->nm_readahead > 0 && ncl_bioread_dora(vp)) { for (nra = 0; nra < nmp->nm_readahead && nra < seqcount && (off_t)(lbn + 1 + nra) * biosize < nsize; nra++) { rabn = lbn + 1 + nra; @@ -678,9 +688,7 @@ ncl_bioread(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred) * directory offset cookie of the next block.) */ NFSLOCKNODE(np); - if (nmp->nm_readahead > 0 && - !vm_object_mightbedirty(vp->v_object) && - vp->v_object->un_pager.vnp.writemappings == 0 && + if (nmp->nm_readahead > 0 && ncl_bioread_dora(vp) && (bp->b_flags & B_INVAL) == 0 && (np->n_direofoffset == 0 || (lbn + 1) * NFS_DIRBLKSIZ < np->n_direofoffset) &&