@@ -171,7 +171,7 @@ static int vfs_statx(int dfd, const char __user *filename, int flags,
int error;
if (flags & ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT | AT_EMPTY_PATH |
- AT_STATX_SYNC_TYPE))
+ AT_STATX_SYNC_TYPE | AT_STATX_CACHED))
return -EINVAL;
if (!(flags & AT_SYMLINK_NOFOLLOW))
@@ -180,6 +180,8 @@ static int vfs_statx(int dfd, const char __user *filename, int flags,
lookup_flags |= LOOKUP_AUTOMOUNT;
if (flags & AT_EMPTY_PATH)
lookup_flags |= LOOKUP_EMPTY;
+ if (flags & AT_STATX_CACHED)
+ lookup_flags |= LOOKUP_CACHED;
retry:
error = user_path_at(dfd, filename, lookup_flags, &path);
@@ -111,4 +111,6 @@
#define AT_RECURSIVE 0x8000 /* Apply to the entire subtree */
+#define AT_STATX_CACHED 0x10000 /* Only succeeds if inode/dentry is already cached */
+
#endif /* _UAPI_LINUX_FCNTL_H */
Since we now have LOOKUP_CACHED to only perform a fast lookup of the dentry cache for path resolution, expose this as AT_STATX_CACHED to provide the same functionality on the statx side. Signed-off-by: Jens Axboe <axboe@kernel.dk> --- fs/stat.c | 4 +++- include/uapi/linux/fcntl.h | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-)