vfs: make fchmodat retry once on ESTALE errors
authorJeff Layton <jlayton@redhat.com>
Tue, 11 Dec 2012 17:10:13 +0000 (12:10 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 20 Dec 2012 23:50:07 +0000 (18:50 -0500)
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/open.c

index a13a54d3e6912d10217406b737bb07ecc70e2d68..99c3ce5f897bece52997c6b3820945d3bfdd8334 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -514,11 +514,16 @@ SYSCALL_DEFINE3(fchmodat, int, dfd, const char __user *, filename, umode_t, mode
 {
        struct path path;
        int error;
-
-       error = user_path_at(dfd, filename, LOOKUP_FOLLOW, &path);
+       unsigned int lookup_flags = LOOKUP_FOLLOW;
+retry:
+       error = user_path_at(dfd, filename, lookup_flags, &path);
        if (!error) {
                error = chmod_common(&path, mode);
                path_put(&path);
+               if (retry_estale(error, lookup_flags)) {
+                       lookup_flags |= LOOKUP_REVAL;
+                       goto retry;
+               }
        }
        return error;
 }