From d929b06292a25c53ddf131780fea5a41e5a09ba3 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Sat, 2 May 2026 19:20:14 -0400 Subject: [PATCH] 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 --- kmod/src/dir.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/kmod/src/dir.c b/kmod/src/dir.c index 6ac65f65..f416deaa 100644 --- a/kmod/src/dir.c +++ b/kmod/src/dir.c @@ -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, };