Commit ec855375 authored by Miklos Szeredi's avatar Miklos Szeredi

fuse: take cache_mask into account in getattr

When deciding to send a GETATTR request take into account the cache mask
(which attributes are always valid).  The cache mask takes precedence over
the invalid mask.

This results in the GETATTR request not being sent unnecessarily.
Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
parent 4b52f059
...@@ -1021,12 +1021,14 @@ static int fuse_update_get_attr(struct inode *inode, struct file *file, ...@@ -1021,12 +1021,14 @@ static int fuse_update_get_attr(struct inode *inode, struct file *file,
struct fuse_inode *fi = get_fuse_inode(inode); struct fuse_inode *fi = get_fuse_inode(inode);
int err = 0; int err = 0;
bool sync; bool sync;
u32 inval_mask = READ_ONCE(fi->inval_mask);
u32 cache_mask = fuse_get_cache_mask(inode);
if (flags & AT_STATX_FORCE_SYNC) if (flags & AT_STATX_FORCE_SYNC)
sync = true; sync = true;
else if (flags & AT_STATX_DONT_SYNC) else if (flags & AT_STATX_DONT_SYNC)
sync = false; sync = false;
else if (request_mask & READ_ONCE(fi->inval_mask)) else if (request_mask & inval_mask & ~cache_mask)
sync = true; sync = true;
else else
sync = time_before64(fi->i_time, get_jiffies_64()); sync = time_before64(fi->i_time, get_jiffies_64());
......
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