diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2018-04-30 22:57:42 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2018-05-22 14:27:56 -0400 |
commit | 9a7dddcaffff3890b9991d014c9a2b5392806526 (patch) | |
tree | 380b9896726e763dd1b31c14e815c401e65532b0 /fs/adfs | |
parent | 686bb96d1bddac7b3f4029bb7bd0a268fce45f03 (diff) | |
download | linux-9a7dddcaffff3890b9991d014c9a2b5392806526.tar.bz2 |
adfs_lookup: do not fail with ENOENT on negatives, use d_splice_alias()
Cc: Russell King <linux@armlinux.org.uk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/adfs')
-rw-r--r-- | fs/adfs/dir.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/adfs/dir.c b/fs/adfs/dir.c index 77a2d6ca3c60..e18eff854e1a 100644 --- a/fs/adfs/dir.c +++ b/fs/adfs/dir.c @@ -252,17 +252,17 @@ adfs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) error = adfs_dir_lookup_byname(dir, &dentry->d_name, &obj); if (error == 0) { - error = -EACCES; /* * This only returns NULL if get_empty_inode * fails. */ inode = adfs_iget(dir->i_sb, &obj); - if (inode) - error = 0; + if (!inode) + inode = ERR_PTR(-EACCES); + } else if (error != -ENOENT) { + inode = ERR_PTR(error); } - d_add(dentry, inode); - return ERR_PTR(error); + return d_splice_alias(inode, dentry); } /* |