summaryrefslogtreecommitdiffstats
path: root/sys/fs/nullfs/null_vfsops.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/fs/nullfs/null_vfsops.c')
-rw-r--r--sys/fs/nullfs/null_vfsops.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c
index 02932bd..ad02236 100644
--- a/sys/fs/nullfs/null_vfsops.c
+++ b/sys/fs/nullfs/null_vfsops.c
@@ -65,7 +65,6 @@ static vfs_statfs_t nullfs_statfs;
static vfs_unmount_t nullfs_unmount;
static vfs_vget_t nullfs_vget;
static vfs_extattrctl_t nullfs_extattrctl;
-static vfs_reclaim_lowervp_t nullfs_reclaim_lowervp;
/*
* Mount null layer
@@ -391,8 +390,37 @@ nullfs_reclaim_lowervp(struct mount *mp, struct vnode *lowervp)
vp = null_hashget(mp, lowervp);
if (vp == NULL)
return;
+ VTONULL(vp)->null_flags |= NULLV_NOUNLOCK;
vgone(vp);
- vn_lock(lowervp, LK_EXCLUSIVE | LK_RETRY);
+ vput(vp);
+}
+
+static void
+nullfs_unlink_lowervp(struct mount *mp, struct vnode *lowervp)
+{
+ struct vnode *vp;
+ struct null_node *xp;
+
+ vp = null_hashget(mp, lowervp);
+ if (vp == NULL)
+ return;
+ xp = VTONULL(vp);
+ xp->null_flags |= NULLV_DROP | NULLV_NOUNLOCK;
+ vhold(vp);
+ vunref(vp);
+
+ /*
+ * If vunref() dropped the last use reference on the nullfs
+ * vnode, it must be reclaimed, and its lock was split from
+ * the lower vnode lock. Need to do extra unlock before
+ * allowing the final vdrop() to free the vnode.
+ */
+ if (vp->v_usecount == 0) {
+ KASSERT((vp->v_iflag & VI_DOOMED) != 0,
+ ("not reclaimed %p", vp));
+ VOP_UNLOCK(vp, 0);
+ }
+ vdrop(vp);
}
static struct vfsops null_vfsops = {
@@ -408,6 +436,7 @@ static struct vfsops null_vfsops = {
.vfs_unmount = nullfs_unmount,
.vfs_vget = nullfs_vget,
.vfs_reclaim_lowervp = nullfs_reclaim_lowervp,
+ .vfs_unlink_lowervp = nullfs_unlink_lowervp,
};
VFS_SET(null_vfsops, nullfs, VFCF_LOOPBACK | VFCF_JAIL);
OpenPOWER on IntegriCloud