Commit ec855375 authored by Miklos Szeredi's avatar Miklos Szeredi
Browse files

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
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1021,12 +1021,14 @@ static int fuse_update_get_attr(struct inode *inode, struct file *file,
	struct fuse_inode *fi = get_fuse_inode(inode);
	int err = 0;
	bool sync;
	u32 inval_mask = READ_ONCE(fi->inval_mask);
	u32 cache_mask = fuse_get_cache_mask(inode);

	if (flags & AT_STATX_FORCE_SYNC)
		sync = true;
	else if (flags & AT_STATX_DONT_SYNC)
		sync = false;
	else if (request_mask & READ_ONCE(fi->inval_mask))
	else if (request_mask & inval_mask & ~cache_mask)
		sync = true;
	else
		sync = time_before64(fi->i_time, get_jiffies_64());