Skip to content

Commit

Permalink
vfs: make fstatat retry on ESTALE errors from getattr call
Browse files Browse the repository at this point in the history
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Jeff Layton authored and Al Viro committed Dec 20, 2012
1 parent b9d6ba9 commit 836fb7e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions fs/stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ int vfs_fstatat(int dfd, const char __user *filename, struct kstat *stat,
{
struct path path;
int error = -EINVAL;
int lookup_flags = 0;
unsigned int lookup_flags = 0;

if ((flag & ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT |
AT_EMPTY_PATH)) != 0)
Expand All @@ -84,13 +84,17 @@ int vfs_fstatat(int dfd, const char __user *filename, struct kstat *stat,
lookup_flags |= LOOKUP_FOLLOW;
if (flag & AT_EMPTY_PATH)
lookup_flags |= LOOKUP_EMPTY;

retry:
error = user_path_at(dfd, filename, lookup_flags, &path);
if (error)
goto out;

error = vfs_getattr(path.mnt, path.dentry, stat);
path_put(&path);
if (retry_estale(error, lookup_flags)) {
lookup_flags |= LOOKUP_REVAL;
goto retry;
}
out:
return error;
}
Expand Down

0 comments on commit 836fb7e

Please sign in to comment.