From owner-svn-src-all@freebsd.org Thu Nov 26 18:16:32 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DED1146B7D6; Thu, 26 Nov 2020 18:16:32 +0000 (UTC) (envelope-from kib@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 "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ChmDJ5yZSz4r4r; Thu, 26 Nov 2020 18:16:32 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BF7B72793A; Thu, 26 Nov 2020 18:16:32 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AQIGWrP037730; Thu, 26 Nov 2020 18:16:32 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AQIGWoQ037729; Thu, 26 Nov 2020 18:16:32 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011261816.0AQIGWoQ037729@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 26 Nov 2020 18:16:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368077 - head/sys/fs/nullfs X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/fs/nullfs X-SVN-Commit-Revision: 368077 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Nov 2020 18:16:32 -0000 Author: kib Date: Thu Nov 26 18:16:32 2020 New Revision: 368077 URL: https://svnweb.freebsd.org/changeset/base/368077 Log: nullfs: provide custom bypass for VOP_READ_PGCACHE(). Normal bypass expects locked vnode, which is not true for VOP_READ_PGCACHE(). Ensure liveness of the lower vnode by taking the upper vnode interlock, which is also taked by null_reclaim() when setting v_data to NULL. Reported and tested by: pho Reviewed by: markj, mjg Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D27327 Modified: head/sys/fs/nullfs/null_vnops.c Modified: head/sys/fs/nullfs/null_vnops.c ============================================================================== --- head/sys/fs/nullfs/null_vnops.c Thu Nov 26 18:13:33 2020 (r368076) +++ head/sys/fs/nullfs/null_vnops.c Thu Nov 26 18:16:32 2020 (r368077) @@ -947,6 +947,28 @@ null_vptocnp(struct vop_vptocnp_args *ap) return (error); } +static int +null_read_pgcache(struct vop_read_pgcache_args *ap) +{ + struct vnode *lvp, *vp; + struct null_node *xp; + int error; + + vp = ap->a_vp; + VI_LOCK(vp); + xp = VTONULL(vp); + if (xp == NULL) { + VI_UNLOCK(vp); + return (EJUSTRETURN); + } + lvp = xp->null_lowervp; + vref(lvp); + VI_UNLOCK(vp); + error = VOP_READ_PGCACHE(lvp, ap->a_uio, ap->a_ioflag, ap->a_cred); + vrele(lvp); + return (error); +} + /* * Global vfs data structures */ @@ -966,6 +988,7 @@ struct vop_vector null_vnodeops = { .vop_lookup = null_lookup, .vop_open = null_open, .vop_print = null_print, + .vop_read_pgcache = null_read_pgcache, .vop_reclaim = null_reclaim, .vop_remove = null_remove, .vop_rename = null_rename,