svn commit: r364288 - head/sys/fs/nullfs
Konstantin Belousov
kib at FreeBSD.org
Sun Aug 16 21:05:57 UTC 2020
Author: kib
Date: Sun Aug 16 21:05:56 2020
New Revision: 364288
URL: https://svnweb.freebsd.org/changeset/base/364288
Log:
VMIO reads: enable for nullfs upper vnode if the lower vnode supports it.
Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D25968
Modified:
head/sys/fs/nullfs/null_subr.c
head/sys/fs/nullfs/null_vnops.c
Modified: head/sys/fs/nullfs/null_subr.c
==============================================================================
--- head/sys/fs/nullfs/null_subr.c Sun Aug 16 21:02:45 2020 (r364287)
+++ head/sys/fs/nullfs/null_subr.c Sun Aug 16 21:05:56 2020 (r364288)
@@ -259,12 +259,33 @@ null_nodeget(mp, lowervp, vpp)
vp->v_vflag |= VV_ROOT;
/*
+ * We might miss the case where lower vnode sets VIRF_PGREAD
+ * some time after construction, which is typical case.
+ * null_open rechecks.
+ */
+ if ((lowervp->v_irflag & VIRF_PGREAD) != 0) {
+ MPASS(lowervp->v_object != NULL);
+ if ((vp->v_irflag & VIRF_PGREAD) == 0) {
+ if (vp->v_object == NULL)
+ vp->v_object = lowervp->v_object;
+ else
+ MPASS(vp->v_object == lowervp->v_object);
+ VI_LOCK(vp);
+ vp->v_irflag |= VIRF_PGREAD;
+ VI_UNLOCK(vp);
+ } else {
+ MPASS(vp->v_object != NULL);
+ }
+ }
+
+ /*
* Atomically insert our new node into the hash or vget existing
* if someone else has beaten us to it.
*/
*vpp = null_hashins(mp, xp);
if (*vpp != NULL) {
vrele(lowervp);
+ vp->v_object = NULL; /* in case VIRF_PGREAD set it */
null_destroy_proto(vp, xp);
return (0);
}
Modified: head/sys/fs/nullfs/null_vnops.c
==============================================================================
--- head/sys/fs/nullfs/null_vnops.c Sun Aug 16 21:02:45 2020 (r364287)
+++ head/sys/fs/nullfs/null_vnops.c Sun Aug 16 21:05:56 2020 (r364288)
@@ -439,8 +439,17 @@ null_open(struct vop_open_args *ap)
vp = ap->a_vp;
ldvp = NULLVPTOLOWERVP(vp);
retval = null_bypass(&ap->a_gen);
- if (retval == 0)
+ if (retval == 0) {
vp->v_object = ldvp->v_object;
+ if ((ldvp->v_irflag & VIRF_PGREAD) != 0) {
+ MPASS(vp->v_object != NULL);
+ if ((vp->v_irflag & VIRF_PGREAD) == 0) {
+ VI_LOCK(vp);
+ vp->v_irflag |= VIRF_PGREAD;
+ VI_UNLOCK(vp);
+ }
+ }
+ }
return (retval);
}
More information about the svn-src-all
mailing list