[PATCH 39/53] ecryptfs: stop using d_add().
NeilBrown
neilb at ownmail.net
Thu Mar 12 14:12:26 PDT 2026
From: NeilBrown <neil at brown.name>
"Best practice" is to use d_splice_alias() at the end of a ->lookup
function. d_add() often works and is not incorrect in ecryptfs, but as
it is planned to remove d_add(), change to use d_splice_alias().
Signed-off-by: NeilBrown <neil at brown.name>
---
fs/ecryptfs/inode.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 8ab014db3e03..beb9e2c8b8b3 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -352,8 +352,7 @@ static struct dentry *ecryptfs_lookup_interpose(struct dentry *dentry,
if (!lower_inode) {
/* We want to add because we couldn't find in lower */
- d_add(dentry, NULL);
- return NULL;
+ return d_splice_alias(NULL, dentry);
}
inode = __ecryptfs_get_inode(lower_inode, dentry->d_sb);
if (IS_ERR(inode)) {
--
2.50.0.107.gf914562f5916.dirty
More information about the linux-afs
mailing list