From nobody Wed Jan 17 10:05:26 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 4TFM2G5PTQz57TQQ; Wed, 17 Jan 2024 10:05:26 +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 4TFM2G4xWkz4XhJ; Wed, 17 Jan 2024 10:05:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705485926; 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=QcfPeiVXJmHGGJLbJKjoiusYw5EUSrUI3poWMAa1rcc=; b=A4/O02H1vbBw5oRo1kJOeqqVljl8UngLbkjfzFFhn0kRVSdweMXp5PFzQSynwknlYPQZFm 8J4r3ERdmZu+0q8bRdRnRVlUrQrI4RNP5Sdu3eb4YJsMLDzDu/VWiC6GEuVAvTzlMfeXbD 4pSpibL3vDqOA0V5zPI3qGsCBzYvwTh7bm249cmwo2yIuXY9LxXVqx2xdLOTSmlp7rzJBa 3MoMrIGuIELEPFSPW8tP1szIj7mHnKUkQkRBMwsqay3ECWhgC5Z4A+pKqz3rYxrV+2edym WxoDGLZi9ciZd/I9tBh8W9CPw2boHGaofO9Cp9r15CSb2JjT6XxISAeZiWVZeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705485926; 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=QcfPeiVXJmHGGJLbJKjoiusYw5EUSrUI3poWMAa1rcc=; b=UPdgsqbCIRIanPiuR7GqIRgWInGmYePB+j93IJMvqTzxRXGnBA54S4pSaRvktSdnoeozSK 4VZb2WuH90VJTyBE55HJLbd5Tu+9VLNqJoOXp7LG3opljfiilHXTaeDNeJXe85qtA0QrwI 7gRmzz7HZ0aUAFr3DZf7OoML6DbRAbMWQlYvAvLek2z1K6pvgIFKXIrAywl2bDAIISE6I2 2kUp+s/PjLAUfEQKjaokedBP/WlLTFG2rL5RSTdgCB+RCZ1XZWQmtVnm9mb0HPyNUHjXb1 vLvqqk1HNNbSEkpnJn5LbGTntOP8K1heOPRNTSmaKip38xDkMQhKqXiWr42daQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1705485926; a=rsa-sha256; cv=none; b=nG0nxYHHHcxhkhcxYPOO3kg+DOSEdmvDCk1WnuOqNNmW7Per9PE80IZZhQbcWC5TccEuVi BxZJlEN+xmHVcEOxsmHBAr53t25bLsu06VRZ7VtSDQy5y+wEZLo8ajl2RBRobjYlBDm0fp oHalsj3tGWoFiL+boSq2BbrYIcm9NcSb+0K63R1bCdfHbpF5wJQxlnhuyHiRYGAC2tKWBI BFIvT/8gdWf2byppedMY+e09PsANfhsJ/kHecgsXnKXGOQ7WV2yhrqjZP2xS4khd3Xaw48 QAYQS8x8pxMDI3O/guF9E+lar3+2RCylY9vDkJtlbvE/U/LYrzQzRZEzHFlCBQ== 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 4TFM2G41kwzJpG; Wed, 17 Jan 2024 10:05:26 +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 40HA5QSY023209; Wed, 17 Jan 2024 10:05:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40HA5QCW023206; Wed, 17 Jan 2024 10:05:26 GMT (envelope-from git) Date: Wed, 17 Jan 2024 10:05:26 GMT Message-Id: <202401171005.40HA5QCW023206@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: 2a22edfc70ad - stable/13 - 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/13 X-Git-Reftype: branch X-Git-Commit: 2a22edfc70ad442bdf5060f48ea673faebfaa386 Auto-Submitted: auto-generated The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2a22edfc70ad442bdf5060f48ea673faebfaa386 commit 2a22edfc70ad442bdf5060f48ea673faebfaa386 Author: Konstantin Belousov AuthorDate: 2024-01-15 11:49:14 +0000 Commit: Konstantin Belousov CommitDate: 2024-01-17 10:04:48 +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) &&