diff options
author | Jeff Layton <jlayton@redhat.com> | 2012-12-11 12:10:11 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-12-20 18:50:05 -0500 |
commit | 48f7530d3f722617aa7cfea62b09b0c1a8d0173e (patch) | |
tree | 3da3fbe9ec3d8f1f50679fc6d030d90d757c7b59 /fs/open.c | |
parent | c6a9428401c00a27d3c17264934d14e284570c97 (diff) |
vfs: have do_sys_truncate retry once on an ESTALE error
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/open.c')
-rw-r--r-- | fs/open.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -115,17 +115,23 @@ EXPORT_SYMBOL_GPL(vfs_truncate); | |||
115 | 115 | ||
116 | static long do_sys_truncate(const char __user *pathname, loff_t length) | 116 | static long do_sys_truncate(const char __user *pathname, loff_t length) |
117 | { | 117 | { |
118 | unsigned int lookup_flags = LOOKUP_FOLLOW; | ||
118 | struct path path; | 119 | struct path path; |
119 | int error; | 120 | int error; |
120 | 121 | ||
121 | if (length < 0) /* sorry, but loff_t says... */ | 122 | if (length < 0) /* sorry, but loff_t says... */ |
122 | return -EINVAL; | 123 | return -EINVAL; |
123 | 124 | ||
124 | error = user_path(pathname, &path); | 125 | retry: |
126 | error = user_path_at(AT_FDCWD, pathname, lookup_flags, &path); | ||
125 | if (!error) { | 127 | if (!error) { |
126 | error = vfs_truncate(&path, length); | 128 | error = vfs_truncate(&path, length); |
127 | path_put(&path); | 129 | path_put(&path); |
128 | } | 130 | } |
131 | if (retry_estale(error, lookup_flags)) { | ||
132 | lookup_flags |= LOOKUP_REVAL; | ||
133 | goto retry; | ||
134 | } | ||
129 | return error; | 135 | return error; |
130 | } | 136 | } |
131 | 137 | ||