diff options
Diffstat (limited to 'fs/stat.c')
-rw-r--r-- | fs/stat.c | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -74,7 +74,7 @@ int vfs_fstatat(int dfd, const char __user *filename, struct kstat *stat, | |||
74 | { | 74 | { |
75 | struct path path; | 75 | struct path path; |
76 | int error = -EINVAL; | 76 | int error = -EINVAL; |
77 | int lookup_flags = 0; | 77 | unsigned int lookup_flags = 0; |
78 | 78 | ||
79 | if ((flag & ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT | | 79 | if ((flag & ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT | |
80 | AT_EMPTY_PATH)) != 0) | 80 | AT_EMPTY_PATH)) != 0) |
@@ -84,13 +84,17 @@ int vfs_fstatat(int dfd, const char __user *filename, struct kstat *stat, | |||
84 | lookup_flags |= LOOKUP_FOLLOW; | 84 | lookup_flags |= LOOKUP_FOLLOW; |
85 | if (flag & AT_EMPTY_PATH) | 85 | if (flag & AT_EMPTY_PATH) |
86 | lookup_flags |= LOOKUP_EMPTY; | 86 | lookup_flags |= LOOKUP_EMPTY; |
87 | 87 | retry: | |
88 | error = user_path_at(dfd, filename, lookup_flags, &path); | 88 | error = user_path_at(dfd, filename, lookup_flags, &path); |
89 | if (error) | 89 | if (error) |
90 | goto out; | 90 | goto out; |
91 | 91 | ||
92 | error = vfs_getattr(path.mnt, path.dentry, stat); | 92 | error = vfs_getattr(path.mnt, path.dentry, stat); |
93 | path_put(&path); | 93 | path_put(&path); |
94 | if (retry_estale(error, lookup_flags)) { | ||
95 | lookup_flags |= LOOKUP_REVAL; | ||
96 | goto retry; | ||
97 | } | ||
94 | out: | 98 | out: |
95 | return error; | 99 | return error; |
96 | } | 100 | } |
@@ -296,11 +300,13 @@ SYSCALL_DEFINE4(readlinkat, int, dfd, const char __user *, pathname, | |||
296 | struct path path; | 300 | struct path path; |
297 | int error; | 301 | int error; |
298 | int empty = 0; | 302 | int empty = 0; |
303 | unsigned int lookup_flags = LOOKUP_EMPTY; | ||
299 | 304 | ||
300 | if (bufsiz <= 0) | 305 | if (bufsiz <= 0) |
301 | return -EINVAL; | 306 | return -EINVAL; |
302 | 307 | ||
303 | error = user_path_at_empty(dfd, pathname, LOOKUP_EMPTY, &path, &empty); | 308 | retry: |
309 | error = user_path_at_empty(dfd, pathname, lookup_flags, &path, &empty); | ||
304 | if (!error) { | 310 | if (!error) { |
305 | struct inode *inode = path.dentry->d_inode; | 311 | struct inode *inode = path.dentry->d_inode; |
306 | 312 | ||
@@ -314,6 +320,10 @@ SYSCALL_DEFINE4(readlinkat, int, dfd, const char __user *, pathname, | |||
314 | } | 320 | } |
315 | } | 321 | } |
316 | path_put(&path); | 322 | path_put(&path); |
323 | if (retry_estale(error, lookup_flags)) { | ||
324 | lookup_flags |= LOOKUP_REVAL; | ||
325 | goto retry; | ||
326 | } | ||
317 | } | 327 | } |
318 | return error; | 328 | return error; |
319 | } | 329 | } |