diff --git a/fs/namei.c b/fs/namei.c index 12ed29712b4e..285e62e925f7 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2250,30 +2250,13 @@ static struct file *do_last(struct nameidata *nd, struct path *path, symlink_ok = 1; /* we _can_ be in RCU mode here */ error = lookup_fast(nd, &nd->last, path, &inode); - if (unlikely(error)) { - if (error < 0) - goto exit; + if (likely(!error)) + goto finish_lookup; - BUG_ON(nd->inode != dir->d_inode); + if (error < 0) + goto exit; - mutex_lock(&dir->d_inode->i_mutex); - dentry = __lookup_hash(&nd->last, dir, nd); - mutex_unlock(&dir->d_inode->i_mutex); - error = PTR_ERR(dentry); - if (IS_ERR(dentry)) - goto exit; - path->mnt = nd->path.mnt; - path->dentry = dentry; - error = follow_managed(path, nd->flags); - if (unlikely(error < 0)) - goto exit_dput; - - if (error) - nd->flags |= LOOKUP_JUMPED; - - inode = path->dentry->d_inode; - } - goto finish_lookup; + BUG_ON(nd->inode != dir->d_inode); } else { /* create side of things */ /*