[PATCH v3 11/15] ovl: pass name buffer to ovl_start_creating_temp()

From: NeilBrown

Date: Tue Feb 24 2026 - 17:27:51 EST


From: NeilBrown <neil@xxxxxxxxxx>

Now ovl_start_creating_temp() is passed a buffer in which to store the
temp name. This will be useful in a future patch were ovl_create_real()
will need access to that name.

Reviewed-by: Amir Goldstein <amir73il@xxxxxxxxx>
Signed-off-by: NeilBrown <neil@xxxxxxxxxx>
---
fs/overlayfs/dir.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
index ff3dbd1ca61f..c4feb89ad1e3 100644
--- a/fs/overlayfs/dir.c
+++ b/fs/overlayfs/dir.c
@@ -66,10 +66,9 @@ void ovl_tempname(char name[OVL_TEMPNAME_SIZE])
}

static struct dentry *ovl_start_creating_temp(struct ovl_fs *ofs,
- struct dentry *workdir)
+ struct dentry *workdir,
+ char name[OVL_TEMPNAME_SIZE])
{
- char name[OVL_TEMPNAME_SIZE];
-
ovl_tempname(name);
return start_creating(ovl_upper_mnt_idmap(ofs), workdir,
&QSTR(name));
@@ -81,11 +80,12 @@ static struct dentry *ovl_whiteout(struct ovl_fs *ofs)
struct dentry *whiteout, *link;
struct dentry *workdir = ofs->workdir;
struct inode *wdir = workdir->d_inode;
+ char name[OVL_TEMPNAME_SIZE];

guard(mutex)(&ofs->whiteout_lock);

if (!ofs->whiteout) {
- whiteout = ovl_start_creating_temp(ofs, workdir);
+ whiteout = ovl_start_creating_temp(ofs, workdir, name);
if (IS_ERR(whiteout))
return whiteout;
err = ovl_do_whiteout(ofs, wdir, whiteout);
@@ -97,7 +97,7 @@ static struct dentry *ovl_whiteout(struct ovl_fs *ofs)
}

if (!ofs->no_shared_whiteout) {
- link = ovl_start_creating_temp(ofs, workdir);
+ link = ovl_start_creating_temp(ofs, workdir, name);
if (IS_ERR(link))
return link;
err = ovl_do_link(ofs, ofs->whiteout, wdir, link);
@@ -247,7 +247,9 @@ struct dentry *ovl_create_temp(struct ovl_fs *ofs, struct dentry *workdir,
struct ovl_cattr *attr)
{
struct dentry *ret;
- ret = ovl_start_creating_temp(ofs, workdir);
+ char name[OVL_TEMPNAME_SIZE];
+
+ ret = ovl_start_creating_temp(ofs, workdir, name);
if (IS_ERR(ret))
return ret;
ret = ovl_create_real(ofs, workdir, ret, attr);
--
2.50.0.107.gf914562f5916.dirty