From: Jeff Layton Date: Tue, 11 Dec 2012 17:10:11 +0000 (-0500) Subject: vfs: have do_sys_truncate retry once on an ESTALE error X-Git-Tag: v3.8-rc1~13^2~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=48f7530d3f722617aa7cfea62b09b0c1a8d0173e;p=profile%2Fcommon%2Fkernel-common.git vfs: have do_sys_truncate retry once on an ESTALE error Signed-off-by: Jeff Layton Signed-off-by: Al Viro --- diff --git a/fs/open.c b/fs/open.c index c819bbda..07449b9 100644 --- a/fs/open.c +++ b/fs/open.c @@ -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; }