Commit 6c673ab393bc18e8bff729cd04cf384d15e72a04
1 parent
79ac5a46c5
Exists in
master
and in
6 other branches
simplify gfs2_lookup()
d_splice_alias() will DTRT when given NULL or ERR_PTR Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Showing 1 changed file with 3 additions and 11 deletions Side-by-side Diff
fs/gfs2/inode.c
... | ... | @@ -792,13 +792,8 @@ |
792 | 792 | static struct dentry *gfs2_lookup(struct inode *dir, struct dentry *dentry, |
793 | 793 | struct nameidata *nd) |
794 | 794 | { |
795 | - struct inode *inode = NULL; | |
796 | - | |
797 | - inode = gfs2_lookupi(dir, &dentry->d_name, 0); | |
798 | - if (inode && IS_ERR(inode)) | |
799 | - return ERR_CAST(inode); | |
800 | - | |
801 | - if (inode) { | |
795 | + struct inode *inode = gfs2_lookupi(dir, &dentry->d_name, 0); | |
796 | + if (inode && !IS_ERR(inode)) { | |
802 | 797 | struct gfs2_glock *gl = GFS2_I(inode)->i_gl; |
803 | 798 | struct gfs2_holder gh; |
804 | 799 | int error; |
805 | 800 | |
... | ... | @@ -808,11 +803,8 @@ |
808 | 803 | return ERR_PTR(error); |
809 | 804 | } |
810 | 805 | gfs2_glock_dq_uninit(&gh); |
811 | - return d_splice_alias(inode, dentry); | |
812 | 806 | } |
813 | - d_add(dentry, inode); | |
814 | - | |
815 | - return NULL; | |
807 | + return d_splice_alias(inode, dentry); | |
816 | 808 | } |
817 | 809 | |
818 | 810 | /** |