while here, ensure all vop_remove field are set, and always call the function.
the change is very conservative: it only adds vnode ref drop/unlock where it was
absent because it should be unreachable (and if it wasn't, it should fix
things).
ok miod@
-/* $OpenBSD: udf_vnops.c,v 1.71 2024/05/12 16:51:05 semarie Exp $ */
+/* $OpenBSD: udf_vnops.c,v 1.72 2024/05/13 11:17:40 semarie Exp $ */
/*
* Copyright (c) 2001, 2002 Scott Long <scottl@freebsd.org>
.vop_fsync = NULL,
.vop_link = NULL,
.vop_mknod = NULL,
- .vop_remove = NULL,
+ .vop_remove = eopnotsupp,
.vop_rename = NULL,
.vop_revoke = NULL,
.vop_mkdir = NULL,
-/* $OpenBSD: vfs_sync.c,v 1.71 2024/05/12 16:51:05 semarie Exp $ */
+/* $OpenBSD: vfs_sync.c,v 1.72 2024/05/13 11:17:40 semarie Exp $ */
/*
* Portions of this code are:
.vop_read = NULL,
.vop_readdir = NULL,
.vop_readlink = NULL,
- .vop_remove = NULL,
+ .vop_remove = eopnotsupp,
.vop_rename = NULL,
.vop_revoke = NULL,
.vop_mkdir = NULL,
-/* $OpenBSD: vfs_vops.c,v 1.35 2022/06/26 05:20:42 visa Exp $ */
+/* $OpenBSD: vfs_vops.c,v 1.36 2024/05/13 11:17:40 semarie Exp $ */
/*
* Copyright (c) 2010 Thordur I. Bjornsson <thib@openbsd.org>
*
int
VOP_REMOVE(struct vnode *dvp, struct vnode *vp, struct componentname *cnp)
{
+ int error;
struct vop_remove_args a;
a.a_dvp = dvp;
a.a_vp = vp;
ASSERT_VP_ISLOCKED(dvp);
ASSERT_VP_ISLOCKED(vp);
- if (dvp->v_op->vop_remove == NULL)
- return (EOPNOTSUPP);
+ error = dvp->v_op->vop_remove(&a);
+
+ if (dvp == vp)
+ vrele(vp);
+ else
+ vput(vp);
+ vput(dvp);
- return ((dvp->v_op->vop_remove)(&a));
+ return error;
}
int
-/* $OpenBSD: fuse_vnops.c,v 1.68 2024/03/25 17:57:07 guenther Exp $ */
+/* $OpenBSD: fuse_vnops.c,v 1.69 2024/05/13 11:17:40 semarie Exp $ */
/*
* Copyright (c) 2012-2013 Sylvestre Gallon <ccna.syl@gmail.com>
*
fb_delete(fbuf);
out:
pool_put(&namei_pool, cnp->cn_pnbuf);
- if (dvp == vp)
- vrele(vp);
- else
- vput(vp);
- vput(dvp);
return (error);
}
-/* $OpenBSD: msdosfs_vnops.c,v 1.140 2023/09/08 20:00:28 mvs Exp $ */
+/* $OpenBSD: msdosfs_vnops.c,v 1.141 2024/05/13 11:17:40 semarie Exp $ */
/* $NetBSD: msdosfs_vnops.c,v 1.63 1997/10/17 11:24:19 ws Exp $ */
/*-
printf("msdosfs_remove(), dep %p, v_usecount %d\n", dep,
ap->a_vp->v_usecount);
#endif
- if (ddep == dep)
- vrele(ap->a_vp);
- else
- vput(ap->a_vp); /* causes msdosfs_inactive() to be called
- * via vrele() */
- vput(ap->a_dvp);
return (error);
}
-/* $OpenBSD: nfs_vnops.c,v 1.198 2024/05/01 13:15:59 jsg Exp $ */
+/* $OpenBSD: nfs_vnops.c,v 1.199 2024/05/13 11:17:40 semarie Exp $ */
/* $NetBSD: nfs_vnops.c,v 1.62.4.1 1996/07/08 20:26:52 jtc Exp $ */
/*
NFS_INVALIDATE_ATTRCACHE(np);
VN_KNOTE(vp, NOTE_DELETE);
VN_KNOTE(dvp, NOTE_WRITE);
- if (vp == dvp)
- vrele(vp);
- else
- vput(vp);
- vput(dvp);
return (error);
}
-/* $OpenBSD: ntfs_vnops.c,v 1.48 2024/05/12 16:51:05 semarie Exp $ */
+/* $OpenBSD: ntfs_vnops.c,v 1.49 2024/05/13 11:17:40 semarie Exp $ */
/* $NetBSD: ntfs_vnops.c,v 1.6 2003/04/10 21:57:26 jdolecek Exp $ */
/*
.vop_link = NULL,
.vop_mknod = NULL,
.vop_readlink = NULL,
- .vop_remove = NULL,
+ .vop_remove = eopnotsupp,
.vop_rename = NULL,
.vop_revoke = NULL,
.vop_mkdir = NULL,
-/* $OpenBSD: tmpfs_vnops.c,v 1.54 2024/03/25 17:57:07 guenther Exp $ */
+/* $OpenBSD: tmpfs_vnops.c,v 1.55 2024/05/13 11:17:41 semarie Exp $ */
/* $NetBSD: tmpfs_vnops.c,v 1.100 2012/11/05 17:27:39 dholland Exp $ */
/*
tmpfs_dirent_t *de;
int error;
- KASSERT(VOP_ISLOCKED(dvp));
- KASSERT(VOP_ISLOCKED(vp));
KASSERT(cnp->cn_flags & HASBUF);
if (vp->v_type == VDIR) {
error = 0;
out:
pool_put(&namei_pool, cnp->cn_pnbuf);
- /* Drop the references and unlock the vnodes. */
- vput(vp);
- if (dvp == vp) {
- vrele(dvp);
- } else {
- vput(dvp);
- }
return error;
}
-/* $OpenBSD: ext2fs_vnops.c,v 1.93 2024/04/13 23:44:11 jsg Exp $ */
+/* $OpenBSD: ext2fs_vnops.c,v 1.94 2024/05/13 11:17:41 semarie Exp $ */
/* $NetBSD: ext2fs_vnops.c,v 1.1 1997/06/11 09:34:09 bouyer Exp $ */
/*
ip->i_flag |= IN_CHANGE;
}
out:
- if (dvp == vp)
- vrele(vp);
- else
- vput(vp);
- vput(dvp);
return (error);
}
-/* $OpenBSD: ufs_vnops.c,v 1.161 2024/03/25 17:57:07 guenther Exp $ */
+/* $OpenBSD: ufs_vnops.c,v 1.162 2024/05/13 11:17:41 semarie Exp $ */
/* $NetBSD: ufs_vnops.c,v 1.18 1996/05/11 18:28:04 mycroft Exp $ */
/*
VN_KNOTE(vp, NOTE_DELETE);
VN_KNOTE(dvp, NOTE_WRITE);
out:
- if (dvp == vp)
- vrele(vp);
- else
- vput(vp);
- vput(dvp);
return (error);
}