[PATCH 2/7] shmem: use d_duplicate()
From: NeilBrown
Date: Mon Sep 28 2026 - 23:56:17 EST
From: NeilBrown <neil@xxxxxxxxxx>
To prepare for d_alloc_parallel() being permitted without a directory
lock, use d_duplicate() when duplicating a dentry in order to create a
whiteout.
Signed-off-by: NeilBrown <neil@xxxxxxxxxx>
---
mm/shmem.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mm/shmem.c b/mm/shmem.c
index 897fa2b61346..8fbab956466c 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -3976,11 +3976,12 @@ static int shmem_whiteout(struct mnt_idmap *idmap,
struct dentry *whiteout;
int error;
- whiteout = d_alloc(old_dentry->d_parent, &old_dentry->d_name);
+ whiteout = d_duplicate(old_dentry);
if (!whiteout)
return -ENOMEM;
error = shmem_mknod(idmap, old_dir, whiteout,
S_IFCHR | WHITEOUT_MODE, WHITEOUT_DEV);
+ d_lookup_done(whiteout);
dput(whiteout);
return error;
}
--
2.50.0.107.gf914562f5916.dirty