Skip to content

Commit

Permalink
vfs: have do_sys_truncate retry once on an ESTALE error
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 c6a9428 commit 48f7530
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion fs/open.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,23 @@ EXPORT_SYMBOL_GPL(vfs_truncate);

static long do_sys_truncate(const char __user *pathname, loff_t length)
{
unsigned int lookup_flags = LOOKUP_FOLLOW;
struct path path;
int error;

if (length < 0) /* sorry, but loff_t says... */
return -EINVAL;

error = user_path(pathname, &path);
retry:
error = user_path_at(AT_FDCWD, pathname, lookup_flags, &path);
if (!error) {
error = vfs_truncate(&path, length);
path_put(&path);
}
if (retry_estale(error, lookup_flags)) {
lookup_flags |= LOOKUP_REVAL;
goto retry;
}
return error;
}

Expand Down

0 comments on commit 48f7530

Please sign in to comment.