Commit e8764a6f authored by Trond Myklebust's avatar Trond Myklebust

NFS: Don't revalidate attributes that are not being asked for

If the user doesn't set STATX_UID/GID/MODE, then don't care if they are
known to be stale. Ditto if we're not being asked for the file size.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent 4cdfeb64
...@@ -857,12 +857,17 @@ int nfs_getattr(struct user_namespace *mnt_userns, const struct path *path, ...@@ -857,12 +857,17 @@ int nfs_getattr(struct user_namespace *mnt_userns, const struct path *path,
/* Check whether the cached attributes are stale */ /* Check whether the cached attributes are stale */
do_update |= force_sync || nfs_attribute_cache_expired(inode); do_update |= force_sync || nfs_attribute_cache_expired(inode);
cache_validity = READ_ONCE(NFS_I(inode)->cache_validity); cache_validity = READ_ONCE(NFS_I(inode)->cache_validity);
do_update |= cache_validity & do_update |= cache_validity & NFS_INO_INVALID_CHANGE;
(NFS_INO_INVALID_ATTR|NFS_INO_INVALID_LABEL);
if (request_mask & STATX_ATIME) if (request_mask & STATX_ATIME)
do_update |= cache_validity & NFS_INO_INVALID_ATIME; do_update |= cache_validity & NFS_INO_INVALID_ATIME;
if (request_mask & (STATX_CTIME|STATX_MTIME)) if (request_mask & STATX_CTIME)
do_update |= cache_validity & NFS_INO_REVAL_PAGECACHE; do_update |= cache_validity & NFS_INO_INVALID_CTIME;
if (request_mask & STATX_MTIME)
do_update |= cache_validity & NFS_INO_INVALID_MTIME;
if (request_mask & STATX_SIZE)
do_update |= cache_validity & NFS_INO_INVALID_SIZE;
if (request_mask & (STATX_UID | STATX_GID | STATX_MODE | STATX_NLINK))
do_update |= cache_validity & NFS_INO_INVALID_OTHER;
if (request_mask & STATX_BLOCKS) if (request_mask & STATX_BLOCKS)
do_update |= cache_validity & NFS_INO_INVALID_BLOCKS; do_update |= cache_validity & NFS_INO_INVALID_BLOCKS;
if (do_update) { if (do_update) {
......
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