Skip to content

Commit 419f2fe

Browse files
committed
nullfs: add a helper for testing if vnode belongs to a nullfs mount
Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D52983
1 parent 035f197 commit 419f2fe

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

sys/fs/nullfs/null.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,16 @@ struct vnode *null_checkvp(struct vnode *vp, char *fil, int lno);
8282
#endif
8383

8484
extern struct vop_vector null_vnodeops;
85+
extern struct vop_vector null_vnodeops_no_unp_bypass;
86+
87+
static inline bool
88+
null_is_nullfs_vnode(struct vnode *vp)
89+
{
90+
const struct vop_vector *op;
91+
92+
op = vp->v_op;
93+
return (op == &null_vnodeops);
94+
}
8595

8696
extern uma_zone_t null_node_zone;
8797

sys/fs/nullfs/null_vfsops.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ nullfs_mount(struct mount *mp)
116116
/*
117117
* Unlock lower node to avoid possible deadlock.
118118
*/
119-
if (mp->mnt_vnodecovered->v_op == &null_vnodeops &&
119+
if (null_is_nullfs_vnode(mp->mnt_vnodecovered) &&
120120
VOP_ISLOCKED(mp->mnt_vnodecovered) == LK_EXCLUSIVE) {
121121
VOP_UNLOCK(mp->mnt_vnodecovered);
122122
isvnunlocked = true;
@@ -150,7 +150,7 @@ nullfs_mount(struct mount *mp)
150150
/*
151151
* Check multi null mount to avoid `lock against myself' panic.
152152
*/
153-
if (mp->mnt_vnodecovered->v_op == &null_vnodeops) {
153+
if (null_is_nullfs_vnode(mp->mnt_vnodecovered)) {
154154
nn = VTONULL(mp->mnt_vnodecovered);
155155
if (nn == NULL || lowerrootvp == nn->null_lowervp) {
156156
NULLFSDEBUG("nullfs_mount: multi null mount?\n");

sys/fs/nullfs/null_vnops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ null_bypass(struct vop_generic_args *ap)
278278
* that aren't. (We must always map first vp or vclean fails.)
279279
*/
280280
if (i != 0 && (*this_vp_p == NULL ||
281-
(*this_vp_p)->v_op != &null_vnodeops)) {
281+
!null_is_nullfs_vnode(*this_vp_p))) {
282282
old_vps[i] = NULL;
283283
} else {
284284
old_vps[i] = *this_vp_p;

0 commit comments

Comments
 (0)