mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
insmntque1(): remove useless arguments
Also remove once-used functions to clean up after failed insmntque1(), which were destructor callbacks in previous life. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D34071
This commit is contained in:
parent
69ae5b9667
commit
66c5fbca77
7 changed files with 38 additions and 55 deletions
|
|
@ -507,18 +507,6 @@ devfs_allocv_drop_refs(int drop_dm_lock, struct devfs_mount *dmp,
|
|||
return (not_found);
|
||||
}
|
||||
|
||||
static void
|
||||
devfs_insmntque_dtr(struct vnode *vp, struct devfs_dirent *de)
|
||||
{
|
||||
|
||||
mtx_lock(&devfs_de_interlock);
|
||||
vp->v_data = NULL;
|
||||
de->de_vnode = NULL;
|
||||
mtx_unlock(&devfs_de_interlock);
|
||||
vgone(vp);
|
||||
vput(vp);
|
||||
}
|
||||
|
||||
/*
|
||||
* devfs_allocv shall be entered with dmp->dm_lock held, and it drops
|
||||
* it on return.
|
||||
|
|
@ -615,9 +603,14 @@ loop:
|
|||
vp->v_data = de;
|
||||
de->de_vnode = vp;
|
||||
mtx_unlock(&devfs_de_interlock);
|
||||
error = insmntque1(vp, mp, NULL, NULL);
|
||||
error = insmntque1(vp, mp);
|
||||
if (error != 0) {
|
||||
devfs_insmntque_dtr(vp, de);
|
||||
mtx_lock(&devfs_de_interlock);
|
||||
vp->v_data = NULL;
|
||||
de->de_vnode = NULL;
|
||||
mtx_unlock(&devfs_de_interlock);
|
||||
vgone(vp);
|
||||
vput(vp);
|
||||
(void) devfs_allocv_drop_refs(1, dmp, de);
|
||||
return (error);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ loop:
|
|||
fd->fd_ix = ix;
|
||||
if (ftype == Fdesc && fmp->flags & FMNT_LINRDLNKF)
|
||||
vp->v_vflag |= VV_READLINK;
|
||||
error = insmntque1(vp, mp, NULL, NULL);
|
||||
error = insmntque1(vp, mp);
|
||||
if (error != 0) {
|
||||
vgone(vp);
|
||||
vput(vp);
|
||||
|
|
|
|||
|
|
@ -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 = insmntque1(vp, mp, NULL, NULL);
|
||||
error = insmntque1(vp, mp);
|
||||
if (error != 0) {
|
||||
vput(lowervp);
|
||||
null_destroy_proto(vp, xp);
|
||||
|
|
|
|||
|
|
@ -822,21 +822,6 @@ tmpfs_destroy_vobject(struct vnode *vp, vm_object_t obj)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Need to clear v_object for insmntque failure.
|
||||
*/
|
||||
static void
|
||||
tmpfs_insmntque_dtr(struct vnode *vp)
|
||||
{
|
||||
|
||||
tmpfs_destroy_vobject(vp, vp->v_object);
|
||||
vp->v_object = NULL;
|
||||
vp->v_data = NULL;
|
||||
vp->v_op = &dead_vnodeops;
|
||||
vgone(vp);
|
||||
vput(vp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocates a new vnode for the node node or returns a new reference to
|
||||
* an existing one if the node had already a vnode referencing it. The
|
||||
|
|
@ -983,9 +968,15 @@ loop:
|
|||
if (vp->v_type != VFIFO)
|
||||
VN_LOCK_ASHARE(vp);
|
||||
|
||||
error = insmntque1(vp, mp, NULL, NULL);
|
||||
error = insmntque1(vp, mp);
|
||||
if (error != 0) {
|
||||
tmpfs_insmntque_dtr(vp);
|
||||
/* Need to clear v_object for insmntque failure. */
|
||||
tmpfs_destroy_vobject(vp, vp->v_object);
|
||||
vp->v_object = NULL;
|
||||
vp->v_data = NULL;
|
||||
vp->v_op = &dead_vnodeops;
|
||||
vgone(vp);
|
||||
vput(vp);
|
||||
vp = NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -389,7 +389,7 @@ unionfs_nodeget(struct mount *mp, struct vnode *uppervp,
|
|||
("%s: NULL dvp for non-root vp %p", __func__, vp));
|
||||
|
||||
vn_lock_pair(lowervp, false, uppervp, false);
|
||||
error = insmntque1(vp, mp, NULL, NULL);
|
||||
error = insmntque1(vp, mp);
|
||||
if (error != 0) {
|
||||
unionfs_nodeget_cleanup(vp, unp);
|
||||
return (error);
|
||||
|
|
|
|||
|
|
@ -1934,22 +1934,8 @@ delmntque(struct vnode *vp)
|
|||
MNT_IUNLOCK(mp);
|
||||
}
|
||||
|
||||
static void
|
||||
insmntque_stddtr(struct vnode *vp, void *dtr_arg)
|
||||
{
|
||||
|
||||
vp->v_data = NULL;
|
||||
vp->v_op = &dead_vnodeops;
|
||||
vgone(vp);
|
||||
vput(vp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Insert into list of vnodes for the new mount point, if available.
|
||||
*/
|
||||
int
|
||||
insmntque1(struct vnode *vp, struct mount *mp,
|
||||
void (*dtr)(struct vnode *, void *), void *dtr_arg)
|
||||
static int
|
||||
insmntque1_int(struct vnode *vp, struct mount *mp, bool dtr)
|
||||
{
|
||||
|
||||
KASSERT(vp->v_mount == NULL,
|
||||
|
|
@ -1974,8 +1960,12 @@ insmntque1(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);
|
||||
if (dtr) {
|
||||
vp->v_data = NULL;
|
||||
vp->v_op = &dead_vnodeops;
|
||||
vgone(vp);
|
||||
vput(vp);
|
||||
}
|
||||
return (EBUSY);
|
||||
}
|
||||
vp->v_mount = mp;
|
||||
|
|
@ -1989,11 +1979,21 @@ insmntque1(struct vnode *vp, struct mount *mp,
|
|||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Insert into list of vnodes for the new mount point, if available.
|
||||
* insmntque() reclaims the vnode on insertion failure, insmntque1()
|
||||
* leaves handling of the vnode to the caller.
|
||||
*/
|
||||
int
|
||||
insmntque(struct vnode *vp, struct mount *mp)
|
||||
{
|
||||
return (insmntque1_int(vp, mp, true));
|
||||
}
|
||||
|
||||
return (insmntque1(vp, mp, insmntque_stddtr, NULL));
|
||||
int
|
||||
insmntque1(struct vnode *vp, struct mount *mp)
|
||||
{
|
||||
return (insmntque1_int(vp, mp, false));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -689,9 +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);
|
||||
int insmntque1(struct vnode *vp, struct mount *mp);
|
||||
u_quad_t init_va_filerev(void);
|
||||
int speedup_syncer(void);
|
||||
int vn_vptocnp(struct vnode **vp, char *buf, size_t *buflen);
|
||||
|
|
|
|||
Loading…
Reference in a new issue