vfs: fix mknodat to retry on ESTALE errors
authorJeff Layton <jlayton@redhat.com>
Thu, 20 Dec 2012 21:00:10 +0000 (16:00 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 20 Dec 2012 23:50:02 +0000 (18:50 -0500)
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/namei.c

index 8f8e41f6eb52d9d84849a4a456d07da974bf5852..b70c191b7e2b48b78d26761010275003395d6f2a 100644 (file)
@@ -3172,12 +3172,13 @@ SYSCALL_DEFINE4(mknodat, int, dfd, const char __user *, filename, umode_t, mode,
        struct dentry *dentry;
        struct path path;
        int error;
+       unsigned int lookup_flags = 0;
 
        error = may_mknod(mode);
        if (error)
                return error;
-
-       dentry = user_path_create(dfd, filename, &path, 0);
+retry:
+       dentry = user_path_create(dfd, filename, &path, lookup_flags);
        if (IS_ERR(dentry))
                return PTR_ERR(dentry);
 
@@ -3200,6 +3201,10 @@ SYSCALL_DEFINE4(mknodat, int, dfd, const char __user *, filename, umode_t, mode,
        }
 out:
        done_path_create(&path, dentry);
+       if (retry_estale(error, lookup_flags)) {
+               lookup_flags |= LOOKUP_REVAL;
+               goto retry;
+       }
        return error;
 }