From: NeilBrown <[email protected]>

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 <[email protected]>
---
 mm/shmem.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/shmem.c b/mm/shmem.c
index b40f3cd48961..6b39a59355d7 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -4030,11 +4030,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


Reply via email to