vfs: denote vnode being a mount point with VIRF_MOUNTPOINT
Reviewed by: kib (previous version) Differential Revision: https://reviews.freebsd.org/D27794
This commit is contained in:
parent
3e506a67bb
commit
82397d7919
sys
contrib/openzfs/module/os/freebsd/spl
kern
sys
@ -240,9 +240,9 @@ mount_snapshot(kthread_t *td, vnode_t **vpp, const char *fstype, char *fspath,
|
||||
#endif
|
||||
VI_LOCK(vp);
|
||||
vp->v_iflag &= ~VI_MOUNT;
|
||||
VI_UNLOCK(vp);
|
||||
|
||||
vn_irflag_set_locked(vp, VIRF_MOUNTPOINT);
|
||||
vp->v_mountedhere = mp;
|
||||
VI_UNLOCK(vp);
|
||||
/* Put the new filesystem on the mount list. */
|
||||
mtx_lock(&mountlist_mtx);
|
||||
TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list);
|
||||
|
@ -4755,21 +4755,10 @@ cache_fplookup_cross_mount(struct cache_fpl *fpl)
|
||||
static bool
|
||||
cache_fplookup_is_mp(struct cache_fpl *fpl)
|
||||
{
|
||||
struct mount *mp;
|
||||
struct vnode *vp;
|
||||
|
||||
vp = fpl->tvp;
|
||||
|
||||
/*
|
||||
* Hack: while this is a union, the pointer tends to be NULL so save on
|
||||
* a branch.
|
||||
*/
|
||||
mp = atomic_load_ptr(&vp->v_mountedhere);
|
||||
if (mp == NULL)
|
||||
return (false);
|
||||
if (vp->v_type == VDIR)
|
||||
return (true);
|
||||
return (false);
|
||||
return ((vn_irflag_read(vp) & VIRF_MOUNTPOINT) != 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1034,8 +1034,9 @@ vfs_domount_first(
|
||||
cache_purge(vp);
|
||||
VI_LOCK(vp);
|
||||
vp->v_iflag &= ~VI_MOUNT;
|
||||
VI_UNLOCK(vp);
|
||||
vn_irflag_set_locked(vp, VIRF_MOUNTPOINT);
|
||||
vp->v_mountedhere = mp;
|
||||
VI_UNLOCK(vp);
|
||||
/* Place the new filesystem at the end of the mount list. */
|
||||
mtx_lock(&mountlist_mtx);
|
||||
TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list);
|
||||
@ -1881,8 +1882,11 @@ dounmount(struct mount *mp, int flags, struct thread *td)
|
||||
mtx_unlock(&mountlist_mtx);
|
||||
EVENTHANDLER_DIRECT_INVOKE(vfs_unmounted, mp, td);
|
||||
if (coveredvp != NULL) {
|
||||
VI_LOCK(coveredvp);
|
||||
vn_irflag_unset_locked(coveredvp, VIRF_MOUNTPOINT);
|
||||
coveredvp->v_mountedhere = NULL;
|
||||
vn_seqc_write_end(coveredvp);
|
||||
vn_seqc_write_end_locked(coveredvp);
|
||||
VI_UNLOCK(coveredvp);
|
||||
VOP_UNLOCK(coveredvp);
|
||||
vdrop(coveredvp);
|
||||
}
|
||||
|
@ -335,8 +335,9 @@ vfs_mountroot_shuffle(struct thread *td, struct mount *mpdevfs)
|
||||
|
||||
VI_LOCK(vporoot);
|
||||
vporoot->v_iflag &= ~VI_MOUNT;
|
||||
VI_UNLOCK(vporoot);
|
||||
vn_irflag_unset_locked(vporoot, VIRF_MOUNTPOINT);
|
||||
vporoot->v_mountedhere = NULL;
|
||||
VI_UNLOCK(vporoot);
|
||||
mporoot->mnt_flag &= ~MNT_ROOTFS;
|
||||
mporoot->mnt_vnodecovered = NULL;
|
||||
vput(vporoot);
|
||||
@ -393,11 +394,17 @@ vfs_mountroot_shuffle(struct thread *td, struct mount *mpdevfs)
|
||||
vpdevfs = mpdevfs->mnt_vnodecovered;
|
||||
if (vpdevfs != NULL) {
|
||||
cache_purge(vpdevfs);
|
||||
VI_LOCK(vpdevfs);
|
||||
vn_irflag_unset_locked(vpdevfs, VIRF_MOUNTPOINT);
|
||||
vpdevfs->v_mountedhere = NULL;
|
||||
VI_UNLOCK(vpdevfs);
|
||||
vrele(vpdevfs);
|
||||
}
|
||||
VI_LOCK(vp);
|
||||
mpdevfs->mnt_vnodecovered = vp;
|
||||
vn_irflag_set_locked(vp, VIRF_MOUNTPOINT);
|
||||
vp->v_mountedhere = mpdevfs;
|
||||
VI_UNLOCK(vp);
|
||||
VOP_UNLOCK(vp);
|
||||
} else
|
||||
vput(vp);
|
||||
|
@ -4042,7 +4042,9 @@ vn_printf(struct vnode *vp, const char *fmt, ...)
|
||||
strlcat(buf, "|VIRF_DOOMED", sizeof(buf));
|
||||
if (irflag & VIRF_PGREAD)
|
||||
strlcat(buf, "|VIRF_PGREAD", sizeof(buf));
|
||||
flags = irflag & ~(VIRF_DOOMED | VIRF_PGREAD);
|
||||
if (irflag & VIRF_MOUNTPOINT)
|
||||
strlcat(buf, "|VIRF_MOUNTPOINT", sizeof(buf));
|
||||
flags = irflag & ~(VIRF_DOOMED | VIRF_PGREAD | VIRF_MOUNTPOINT);
|
||||
if (flags != 0) {
|
||||
snprintf(buf2, sizeof(buf2), "|VIRF(0x%lx)", flags);
|
||||
strlcat(buf, buf2, sizeof(buf));
|
||||
|
@ -246,6 +246,7 @@ struct xvnode {
|
||||
#define VIRF_DOOMED 0x0001 /* This vnode is being recycled */
|
||||
#define VIRF_PGREAD 0x0002 /* Direct reads from the page cache are permitted,
|
||||
never cleared once set */
|
||||
#define VIRF_MOUNTPOINT 0x0004 /* This vnode is mounted on */
|
||||
|
||||
#define VI_TEXT_REF 0x0001 /* Text ref grabbed use ref */
|
||||
#define VI_MOUNT 0x0002 /* Mount in progress */
|
||||
|
Loading…
x
Reference in New Issue
Block a user