vfs: do_last(): make ENOENT exit RCU safe
authorMiklos Szeredi <mszeredi@suse.cz>
Mon, 21 May 2012 15:30:10 +0000 (17:30 +0200)
committerAl Viro <viro@zeniv.linux.org.uk>
Fri, 1 Jun 2012 16:11:58 +0000 (12:11 -0400)
This will allow this code to be used in RCU mode.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/namei.c

index c6b996817bb39cd6778a5c6caaf3eb92c20ae4fa..a7e994bb78c2b602b2c70d11d83b42495e12123a 100644 (file)
@@ -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) {