From 54c33e7f95284539e52ec2d99dcdf6efd29b247f Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Mon, 21 May 2012 17:30:10 +0200 Subject: [PATCH] vfs: do_last(): make ENOENT exit RCU safe This will allow this code to be used in RCU mode. Signed-off-by: Miklos Szeredi Signed-off-by: Al Viro --- fs/namei.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index c6b996817bb3..a7e994bb78c2 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2361,8 +2361,10 @@ static struct file *do_last(struct nameidata *nd, struct path *path, BUG_ON(nd->flags & LOOKUP_RCU); inode = path->dentry->d_inode; error = -ENOENT; - if (!inode) - goto exit_dput; + if (!inode) { + path_to_nameidata(path, nd); + goto exit; + } if (should_follow_link(inode, !symlink_ok)) { if (nd->flags & LOOKUP_RCU) {