Skip to content

Commit

Permalink
adfs_lookup: do not fail with ENOENT on negatives, use d_splice_alias()
Browse files Browse the repository at this point in the history
Cc: Russell King <[email protected]>
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed May 22, 2018
1 parent 686bb96 commit 9a7dddc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions fs/adfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/*
Expand Down

0 comments on commit 9a7dddc

Please sign in to comment.