diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2011-07-17 10:22:27 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-07-20 20:48:02 -0400 |
commit | 6c673ab393bc18e8bff729cd04cf384d15e72a04 (patch) | |
tree | e1eed0667626c8b092d27500560808d834d21e8d /fs/gfs2 | |
parent | 79ac5a46c5c1c17476fbf84b4d4600d6d565defd (diff) |
simplify gfs2_lookup()
d_splice_alias() will DTRT when given NULL or ERR_PTR
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/inode.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index b1090d66a6fd..0fb51a96eff0 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -792,13 +792,8 @@ static int gfs2_create(struct inode *dir, struct dentry *dentry, | |||
792 | static struct dentry *gfs2_lookup(struct inode *dir, struct dentry *dentry, | 792 | static struct dentry *gfs2_lookup(struct inode *dir, struct dentry *dentry, |
793 | struct nameidata *nd) | 793 | struct nameidata *nd) |
794 | { | 794 | { |
795 | struct inode *inode = NULL; | 795 | struct inode *inode = gfs2_lookupi(dir, &dentry->d_name, 0); |
796 | 796 | if (inode && !IS_ERR(inode)) { | |
797 | inode = gfs2_lookupi(dir, &dentry->d_name, 0); | ||
798 | if (inode && IS_ERR(inode)) | ||
799 | return ERR_CAST(inode); | ||
800 | |||
801 | if (inode) { | ||
802 | struct gfs2_glock *gl = GFS2_I(inode)->i_gl; | 797 | struct gfs2_glock *gl = GFS2_I(inode)->i_gl; |
803 | struct gfs2_holder gh; | 798 | struct gfs2_holder gh; |
804 | int error; | 799 | int error; |
@@ -808,11 +803,8 @@ static struct dentry *gfs2_lookup(struct inode *dir, struct dentry *dentry, | |||
808 | return ERR_PTR(error); | 803 | return ERR_PTR(error); |
809 | } | 804 | } |
810 | gfs2_glock_dq_uninit(&gh); | 805 | gfs2_glock_dq_uninit(&gh); |
811 | return d_splice_alias(inode, dentry); | ||
812 | } | 806 | } |
813 | d_add(dentry, inode); | 807 | return d_splice_alias(inode, dentry); |
814 | |||
815 | return NULL; | ||
816 | } | 808 | } |
817 | 809 | ||
818 | /** | 810 | /** |