autofs braino fix for do_last()
[cascardo/linux.git] / fs / namei.c
index 3d9511e..d7c0cac 100644 (file)
@@ -3260,6 +3260,10 @@ static int do_last(struct nameidata *nd,
                got_write = false;
        }
 
+       error = follow_managed(&path, nd);
+       if (unlikely(error < 0))
+               return error;
+
        if (unlikely(d_is_negative(path.dentry))) {
                path_to_nameidata(&path, nd);
                return -ENOENT;
@@ -3275,10 +3279,6 @@ static int do_last(struct nameidata *nd,
                return -EEXIST;
        }
 
-       error = follow_managed(&path, nd);
-       if (unlikely(error < 0))
-               return error;
-
        seq = 0;        /* out of RCU mode, so the value doesn't matter */
        inode = d_backing_inode(path.dentry);
 finish_lookup: