Commit 48f7530d authored by Jeff Layton's avatar Jeff Layton Committed by Al Viro

vfs: have do_sys_truncate retry once on an ESTALE error

Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent c6a94284
...@@ -115,17 +115,23 @@ EXPORT_SYMBOL_GPL(vfs_truncate); ...@@ -115,17 +115,23 @@ EXPORT_SYMBOL_GPL(vfs_truncate);
static long do_sys_truncate(const char __user *pathname, loff_t length) static long do_sys_truncate(const char __user *pathname, loff_t length)
{ {
unsigned int lookup_flags = LOOKUP_FOLLOW;
struct path path; struct path path;
int error; int error;
if (length < 0) /* sorry, but loff_t says... */ if (length < 0) /* sorry, but loff_t says... */
return -EINVAL; return -EINVAL;
error = user_path(pathname, &path); retry:
error = user_path_at(AT_FDCWD, pathname, lookup_flags, &path);
if (!error) { if (!error) {
error = vfs_truncate(&path, length); error = vfs_truncate(&path, length);
path_put(&path); path_put(&path);
} }
if (retry_estale(error, lookup_flags)) {
lookup_flags |= LOOKUP_REVAL;
goto retry;
}
return error; return error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment