Re: [PATCH 12/13] ovl: remove ovl_lock_rename_workdir()

Jeff Layton
2026-02-05T12:58:58Z

On Wed, 2026-02-04 at 15:57 +1100, NeilBrown wrote:
> From: NeilBrown <neil@brown.name>
>
> This function is unused.
>
> Signed-off-by: NeilBrown <neil@brown.name>
> ---
> fs/overlayfs/overlayfs.h | 2 --
> fs/overlayfs/util.c | 25 -------------------------
> 2 files changed, 27 deletions(-)
>
> diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h
> index 4fb4750a83e4..3eedc2684c23 100644
> --- a/fs/overlayfs/overlayfs.h
> +++ b/fs/overlayfs/overlayfs.h
> @@ -569,8 +569,6 @@ bool ovl_is_inuse(struct dentry *dentry);
> bool ovl_need_index(struct dentry *dentry);
> int ovl_nlink_start(struct dentry *dentry);
> void ovl_nlink_end(struct dentry *dentry);
> -int ovl_lock_rename_workdir(struct dentry *workdir, struct dentry *work,
> - struct dentry *upperdir, struct dentry *upper);
> int ovl_check_metacopy_xattr(struct ovl_fs *ofs, const struct path *path,
> struct ovl_metacopy *data);
> int ovl_set_metacopy_xattr(struct ovl_fs *ofs, struct dentry *d,
> diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c
> index 94986d11a166..810c8752b4f7 100644
> --- a/fs/overlayfs/util.c
> +++ b/fs/overlayfs/util.c
> @@ -1213,31 +1213,6 @@ void ovl_nlink_end(struct dentry *dentry)
> ovl_inode_unlock(inode);
> }
>
> -int ovl_lock_rename_workdir(struct dentry *workdir, struct dentry *work,
> - struct dentry *upperdir, struct dentry *upper)
> -{
> - struct dentry *trap;
> -
> - /* Workdir should not be subdir of upperdir and vice versa */
> - trap = lock_rename(workdir, upperdir);
> - if (IS_ERR(trap))
> - goto err;
> - if (trap)
> - goto err_unlock;
> - if (work && (work->d_parent != workdir || d_unhashed(work)))
> - goto err_unlock;
> - if (upper && (upper->d_parent != upperdir || d_unhashed(upper)))
> - goto err_unlock;
> -
> - return 0;
> -
> -err_unlock:
> - unlock_rename(workdir, upperdir);
> -err:
> - pr_err("failed to lock workdir+upperdir\n");
> - return -EIO;
> -}
> -
> /*
> * err < 0, 0 if no metacopy xattr, metacopy data size if xattr found.
> * an empty xattr returns OVL_METACOPY_MIN_SIZE to distinguish from no xattr value.

Reviewed-by: Jeff Layton <jlayton@kernel.org>