summaryrefslogtreecommitdiff
path: root/fs/afs/dynroot.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2018-06-23 20:48:31 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2018-08-05 15:41:16 -0400
commit855371bd01b4cd8cf0e2b8ca172a5c30a481f963 (patch)
tree65722f0d22ccccc3b86ce4e772264d045475fcf0 /fs/afs/dynroot.c
parent50f307401113350a8d46ca45cace07a92c9bedc8 (diff)
afs: switch dynroot lookups to d_splice_alias()
->lookup() methods can (and should) use d_splice_alias() instead of d_add(). Even if they are not going to be hit by open_by_handle(), code does get copied around... Acked-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/afs/dynroot.c')
-rw-r--r--fs/afs/dynroot.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/fs/afs/dynroot.c b/fs/afs/dynroot.c
index 174e843f0633..40fea59067b3 100644
--- a/fs/afs/dynroot.c
+++ b/fs/afs/dynroot.c
@@ -143,7 +143,6 @@ static struct dentry *afs_dynroot_lookup(struct inode *dir, struct dentry *dentr
{
struct afs_vnode *vnode;
struct inode *inode;
- int ret;
vnode = AFS_FS_I(dir);
@@ -161,21 +160,10 @@ static struct dentry *afs_dynroot_lookup(struct inode *dir, struct dentry *dentr
return afs_lookup_atcell(dentry);
inode = afs_try_auto_mntpt(dentry, dir);
- if (IS_ERR(inode)) {
- ret = PTR_ERR(inode);
- if (ret == -ENOENT) {
- d_add(dentry, NULL);
- _leave(" = NULL [negative]");
- return NULL;
- }
- _leave(" = %d [do]", ret);
- return ERR_PTR(ret);
- }
+ if (inode == ERR_PTR(-ENOENT))
+ inode = NULL;
- d_add(dentry, inode);
- _leave(" = 0 { ino=%lu v=%u }",
- d_inode(dentry)->i_ino, d_inode(dentry)->i_generation);
- return NULL;
+ return d_splice_alias(inode, dentry);
}
const struct inode_operations afs_dynroot_inode_operations = {