From: Al Viro Date: Tue, 1 May 2018 03:04:19 +0000 (-0400) Subject: xfs_vn_lookup: simplify a bit X-Git-Tag: v4.18-rc1~179^2~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b113a6d3cf939e9f26c89ba0ad6d8a1503bac1b2;p=thirdparty%2Fkernel%2Flinux.git xfs_vn_lookup: simplify a bit have all post-xfs_lookup() branches converge on d_splice_alias() Cc: Darrick J. Wong Signed-off-by: Al Viro --- diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index a3ed3c811dfa4..df42e4cb4dc42 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -260,6 +260,7 @@ xfs_vn_lookup( struct dentry *dentry, unsigned int flags) { + struct inode *inode; struct xfs_inode *cip; struct xfs_name name; int error; @@ -269,14 +270,13 @@ xfs_vn_lookup( xfs_dentry_to_name(&name, dentry); error = xfs_lookup(XFS_I(dir), &name, &cip, NULL); - if (unlikely(error)) { - if (unlikely(error != -ENOENT)) - return ERR_PTR(error); - d_add(dentry, NULL); - return NULL; - } - - return d_splice_alias(VFS_I(cip), dentry); + if (likely(!error)) + inode = VFS_I(cip); + else if (likely(error == -ENOENT)) + inode = NULL; + else + inode = ERR_PTR(error); + return d_splice_alias(inode, dentry); } STATIC struct dentry *