git: e486066cf48a - main - VOP_RENAME(9): add flags argument
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 05 Mar 2026 23:48:17 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=e486066cf48a89ba87fab6b3d2b56f271f50439b
commit e486066cf48a89ba87fab6b3d2b56f271f50439b
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-02-26 18:22:48 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-03-05 23:46:53 +0000
VOP_RENAME(9): add flags argument
Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D55539
---
sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c | 3 +++
sys/fs/fuse/fuse_vnops.c | 4 ++++
sys/fs/msdosfs/msdosfs_vnops.c | 5 +++++
sys/fs/nfsclient/nfs_clvnops.c | 6 ++++++
sys/fs/nfsserver/nfs_nfsdport.c | 2 +-
sys/fs/nullfs/null_vnops.c | 3 ++-
sys/fs/p9fs/p9fs_vnops.c | 5 +++++
sys/fs/smbfs/smbfs_vnops.c | 5 +++++
sys/fs/tmpfs/tmpfs_vnops.c | 5 +++++
sys/fs/unionfs/union_vnops.c | 7 ++++++-
sys/kern/vfs_syscalls.c | 2 +-
sys/kern/vnode_if.src | 1 +
sys/ufs/ufs/ufs_vnops.c | 7 +++++++
13 files changed, 51 insertions(+), 4 deletions(-)
diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c
index 31654ec82392..04fd772603b9 100644
--- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c
+++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c
@@ -5527,6 +5527,9 @@ zfs_freebsd_rename(struct vop_rename_args *ap)
}
#endif
+ if (error == 0 && ap->a_flags != 0)
+ error = EOPNOTSUPP;
+
if (error == 0) {
error = zfs_do_rename(fdvp, &fvp, ap->a_fcnp, tdvp, &tvp,
ap->a_tcnp, ap->a_fcnp->cn_cred);
diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c
index 49014a1cdd35..c66d3bcf01e0 100644
--- a/sys/fs/fuse/fuse_vnops.c
+++ b/sys/fs/fuse/fuse_vnops.c
@@ -2254,6 +2254,10 @@ fuse_vnop_rename(struct vop_rename_args *ap)
err = EXTERROR(EXDEV, "Cross-device rename");
goto out;
}
+ if (ap->a_flags != 0) {
+ err = EOPNOTSUPP;
+ goto out;
+ }
cache_purge(fvp);
/*
diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c
index 6dfac1b4ebd2..3e28a7ce9d05 100644
--- a/sys/fs/msdosfs/msdosfs_vnops.c
+++ b/sys/fs/msdosfs/msdosfs_vnops.c
@@ -970,6 +970,11 @@ msdosfs_rename(struct vop_rename_args *ap)
goto abortit;
}
+ if (ap->a_flags != 0) {
+ error = EOPNOTSUPP;
+ goto abortit;
+ }
+
/*
* If source and dest are the same, do nothing.
*/
diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c
index 8e4d58c0e554..edd6974a50d0 100644
--- a/sys/fs/nfsclient/nfs_clvnops.c
+++ b/sys/fs/nfsclient/nfs_clvnops.c
@@ -2196,6 +2196,12 @@ nfs_rename(struct vop_rename_args *ap)
error = EXDEV;
goto out;
}
+
+ if (ap->a_flags != 0) {
+ error = EOPNOTSUPP;
+ goto out;
+ }
+
nmp = VFSTONFS(fvp->v_mount);
if (fvp == tvp) {
diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c
index 833203cd86fc..350785487a2b 100644
--- a/sys/fs/nfsserver/nfs_nfsdport.c
+++ b/sys/fs/nfsserver/nfs_nfsdport.c
@@ -1715,7 +1715,7 @@ out:
if (error == 0) {
error = VOP_RENAME(fromndp->ni_dvp, fromndp->ni_vp,
&fromndp->ni_cnd, tondp->ni_dvp, tondp->ni_vp,
- &tondp->ni_cnd);
+ &tondp->ni_cnd, 0);
lockmgr(&mp->mnt_renamelock, LK_RELEASE, 0);
vfs_rel(mp);
} else {
diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c
index d4baabeb40ab..a372a46bc6c6 100644
--- a/sys/fs/nullfs/null_vnops.c
+++ b/sys/fs/nullfs/null_vnops.c
@@ -741,7 +741,8 @@ null_rename(struct vop_rename_args *ap)
ltvp = NULL;
}
- error = VOP_RENAME(lfdvp, lfvp, ap->a_fcnp, ltdvp, ltvp, ap->a_tcnp);
+ error = VOP_RENAME(lfdvp, lfvp, ap->a_fcnp, ltdvp, ltvp, ap->a_tcnp,
+ ap->a_flags);
vrele(fdvp);
vrele(fvp);
vrele(tdvp);
diff --git a/sys/fs/p9fs/p9fs_vnops.c b/sys/fs/p9fs/p9fs_vnops.c
index 2ed1be82b57f..e64d7840f7f9 100644
--- a/sys/fs/p9fs/p9fs_vnops.c
+++ b/sys/fs/p9fs/p9fs_vnops.c
@@ -2084,6 +2084,11 @@ p9fs_rename(struct vop_rename_args *ap)
goto out;
}
+ if (ap->a_flags != 0) {
+ error = EOPNOTSUPP;
+ goto out;
+ }
+
/* warning if you are renaming to the same name */
if (fvp == tvp)
error = 0;
diff --git a/sys/fs/smbfs/smbfs_vnops.c b/sys/fs/smbfs/smbfs_vnops.c
index e960d8d78b66..3a6fcf862be2 100644
--- a/sys/fs/smbfs/smbfs_vnops.c
+++ b/sys/fs/smbfs/smbfs_vnops.c
@@ -577,6 +577,11 @@ smbfs_rename(struct vop_rename_args *ap)
goto out;
}
+ if (ap->a_flags != 0) {
+ error = EOPNOTSUPP;
+ goto out;
+ }
+
if (tvp && vrefcnt(tvp) > 1) {
error = EBUSY;
goto out;
diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c
index 341c88e19115..6b32f53b3363 100644
--- a/sys/fs/tmpfs/tmpfs_vnops.c
+++ b/sys/fs/tmpfs/tmpfs_vnops.c
@@ -993,6 +993,11 @@ tmpfs_rename(struct vop_rename_args *v)
goto out;
}
+ if (v->a_flags != 0) {
+ error = EOPNOTSUPP;
+ goto out;
+ }
+
/* If source and target are the same file, there is nothing to do. */
if (fvp == tvp) {
error = 0;
diff --git a/sys/fs/unionfs/union_vnops.c b/sys/fs/unionfs/union_vnops.c
index 63e5cd54ade5..cfa0f4ab768e 100644
--- a/sys/fs/unionfs/union_vnops.c
+++ b/sys/fs/unionfs/union_vnops.c
@@ -1413,6 +1413,11 @@ unionfs_rename(struct vop_rename_args *ap)
goto unionfs_rename_abort;
}
+ if (ap->a_flags != 0) {
+ error = EOPNOTSUPP;
+ goto unionfs_rename_abort;
+ }
+
/* Renaming a file to itself has no effect. */
if (fvp == tvp)
goto unionfs_rename_abort;
@@ -1581,7 +1586,7 @@ unionfs_rename(struct vop_rename_args *ap)
if (rfvp == rtvp)
goto unionfs_rename_abort;
- error = VOP_RENAME(rfdvp, rfvp, fcnp, rtdvp, rtvp, tcnp);
+ error = VOP_RENAME(rfdvp, rfvp, fcnp, rtdvp, rtvp, tcnp, ap->a_flags);
if (error == 0) {
if (rtvp != NULL && rtvp->v_type == VDIR)
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 68f155de3db2..be296f41809e 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -3887,7 +3887,7 @@ again1:
out:
if (error == 0) {
error = VOP_RENAME(fromnd.ni_dvp, fromnd.ni_vp, &fromnd.ni_cnd,
- tond.ni_dvp, tond.ni_vp, &tond.ni_cnd);
+ tond.ni_dvp, tond.ni_vp, &tond.ni_cnd, 0);
NDFREE_PNBUF(&fromnd);
NDFREE_PNBUF(&tond);
} else {
diff --git a/sys/kern/vnode_if.src b/sys/kern/vnode_if.src
index 3faefb607f24..6b7448d9f1df 100644
--- a/sys/kern/vnode_if.src
+++ b/sys/kern/vnode_if.src
@@ -336,6 +336,7 @@ vop_rename {
IN WILLRELE struct vnode *tdvp;
IN WILLRELE struct vnode *tvp;
IN struct componentname *tcnp;
+ IN u_int flags;
};
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c
index 736c5a66267e..429e6b5c8dd7 100644
--- a/sys/ufs/ufs/ufs_vnops.c
+++ b/sys/ufs/ufs/ufs_vnops.c
@@ -1255,6 +1255,7 @@ ufs_rename(
struct vnode *a_tdvp;
struct vnode *a_tvp;
struct componentname *a_tcnp;
+ u_int a_flags;
} */ *ap)
{
struct vnode *tvp = ap->a_tvp;
@@ -1293,6 +1294,12 @@ ufs_rename(
goto releout;
}
+ if (ap->a_flags != 0) {
+ error = EOPNOTSUPP;
+ mp = NULL;
+ goto releout;
+ }
+
fdvp_s = fvp_s = tdvp_s = tvp_s = SEQC_MOD;
relock:
/*