Revert b58ca5df0b ("vfs: remove the now unused insmntque1")

I was somehow convinced that insmntque calls insmntque1 with a NULL
destructor. Unfortunately this worked well enough to not immediately
blow up in simple testing.

Keep not using the destructor in previously patched filesystems though
as it avoids unnecessary casts.

Noted by:	kib
Reported by:	pho
This commit is contained in:
Mateusz Guzik 2022-01-27 16:24:32 +00:00
parent 8a7404b2ae
commit 2a7e4cf843
8 changed files with 20 additions and 8 deletions

View file

@ -615,7 +615,7 @@ loop:
vp->v_data = de;
de->de_vnode = vp;
mtx_unlock(&devfs_de_interlock);
error = insmntque(vp, mp);
error = insmntque1(vp, mp, NULL, NULL);
if (error != 0) {
devfs_insmntque_dtr(vp, de);
(void) devfs_allocv_drop_refs(1, dmp, de);

View file

@ -191,7 +191,7 @@ loop:
fd->fd_ix = ix;
if (ftype == Fdesc && fmp->flags & FMNT_LINRDLNKF)
vp->v_vflag |= VV_READLINK;
error = insmntque(vp, mp);
error = insmntque1(vp, mp, NULL, NULL);
if (error != 0) {
vgone(vp);
vput(vp);

View file

@ -202,7 +202,7 @@ null_nodeget(struct mount *mp, struct vnode *lowervp, struct vnode **vpp)
}
/*
* The insmntque() call below requires the exclusive lock on
* The insmntque1() call below requires the exclusive lock on
* the nullfs vnode. Upgrade the lock now if hash failed to
* provide ready to use vnode.
*/
@ -235,7 +235,7 @@ null_nodeget(struct mount *mp, struct vnode *lowervp, struct vnode **vpp)
vp->v_type = lowervp->v_type;
vp->v_data = xp;
vp->v_vnlock = lowervp->v_vnlock;
error = insmntque(vp, mp);
error = insmntque1(vp, mp, NULL, NULL);
if (error != 0) {
vput(lowervp);
null_destroy_proto(vp, xp);

View file

@ -983,7 +983,7 @@ loop:
if (vp->v_type != VFIFO)
VN_LOCK_ASHARE(vp);
error = insmntque(vp, mp);
error = insmntque1(vp, mp, NULL, NULL);
if (error != 0) {
tmpfs_insmntque_dtr(vp);
vp = NULL;

View file

@ -386,7 +386,7 @@ unionfs_nodeget(struct mount *mp, struct vnode *uppervp,
vp->v_vflag |= VV_ROOT;
vn_lock_pair(lowervp, false, uppervp, false);
error = insmntque(vp, mp);
error = insmntque1(vp, mp, NULL, NULL);
if (error != 0) {
unionfs_nodeget_cleanup(vp, unp);
return (error);

View file

@ -1948,7 +1948,8 @@ insmntque_stddtr(struct vnode *vp, void *dtr_arg)
* Insert into list of vnodes for the new mount point, if available.
*/
int
insmntque(struct vnode *vp, struct mount *mp)
insmntque1(struct vnode *vp, struct mount *mp,
void (*dtr)(struct vnode *, void *), void *dtr_arg)
{
KASSERT(vp->v_mount == NULL,
@ -1973,6 +1974,8 @@ insmntque(struct vnode *vp, struct mount *mp)
(vp->v_vflag & VV_FORCEINSMQ) == 0) {
VI_UNLOCK(vp);
MNT_IUNLOCK(mp);
if (dtr != NULL)
dtr(vp, dtr_arg);
return (EBUSY);
}
vp->v_mount = mp;
@ -1986,6 +1989,13 @@ insmntque(struct vnode *vp, struct mount *mp)
return (0);
}
int
insmntque(struct vnode *vp, struct mount *mp)
{
return (insmntque1(vp, mp, insmntque_stddtr, NULL));
}
/*
* Flush out and invalidate all buffers associated with a bufobj
* Called with the underlying object locked.

View file

@ -76,7 +76,7 @@
* cannot include sys/param.h and should only be updated here.
*/
#undef __FreeBSD_version
#define __FreeBSD_version 1400052
#define __FreeBSD_version 1400051
/*
* __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,

View file

@ -689,6 +689,8 @@ int getnewvnode(const char *tag, struct mount *mp, struct vop_vector *vops,
struct vnode **vpp);
void getnewvnode_reserve(void);
void getnewvnode_drop_reserve(void);
int insmntque1(struct vnode *vp, struct mount *mp,
void (*dtr)(struct vnode *, void *), void *dtr_arg);
int insmntque(struct vnode *vp, struct mount *mp);
u_quad_t init_va_filerev(void);
int speedup_syncer(void);