Collapse scoutfs_rename2 into scoutfs_rename_common.

scoutfs_rename2 was a thin shim that validated flags and forwarded
to scoutfs_rename_common. It existed because the old el7
RHEL_IOPS_WRAPPER path used a non-flag-taking .rename op alongside
.rename2; with that path gone there is only one rename method,
and the wrapper has no purpose.

Move the RENAME_NOREPLACE flag validation into scoutfs_rename_common
and point the directory inode_operations .rename slot at it directly.
The symlink inode_operations already used scoutfs_rename_common, so
this also makes symlink rename consistently reject unknown flags
instead of silently accepting them.

Signed-off-by: Auke Kok <auke.kok@versity.com>
This commit is contained in:
Auke Kok
2026-06-08 11:27:46 -07:00
parent f4a28f1f04
commit d929b06292
+4 -13
View File
@@ -1618,6 +1618,9 @@ static int scoutfs_rename_common(KC_VFS_NS_DEF
int ret;
int err;
if (flags & ~RENAME_NOREPLACE)
return -EINVAL;
trace_scoutfs_rename(sb, old_dir, old_dentry, new_dir, new_dentry);
old_hash = dirent_name_hash(old_dentry->d_name.name,
@@ -1864,18 +1867,6 @@ out_unlock:
}
static int scoutfs_rename2(KC_VFS_NS_DEF
struct inode *old_dir,
struct dentry *old_dentry, struct inode *new_dir,
struct dentry *new_dentry, unsigned int flags)
{
if (flags & ~RENAME_NOREPLACE)
return -EINVAL;
return scoutfs_rename_common(KC_VFS_NS
old_dir, old_dentry, new_dir, new_dentry, flags);
}
static int scoutfs_tmpfile(KC_VFS_NS_DEF
struct inode *dir,
@@ -1994,5 +1985,5 @@ const struct inode_operations scoutfs_dir_iops = {
.symlink = scoutfs_symlink,
.permission = scoutfs_permission,
.tmpfile = scoutfs_tmpfile,
.rename = scoutfs_rename2,
.rename = scoutfs_rename_common,
};