fuse: don't need GETATTR after every READ
authorMiklos Szeredi <mszeredi@redhat.com>
Mon, 15 Oct 2018 13:43:06 +0000 (15:43 +0200)
committerMiklos Szeredi <mszeredi@redhat.com>
Mon, 15 Oct 2018 13:43:06 +0000 (15:43 +0200)
commit802dc0497be2b538ca4300704b45b59bffe29585
treed93976a0f3c7162eeb80933eab2c9b906fb5c57a
parent2f1e81965fd0f672c3246e751385cdfe8f86bbee
fuse: don't need GETATTR after every READ

If 'auto_inval_data' mode is active, then fuse_file_read_iter() will call
fuse_update_attributes(), which will check the attribute validity and send
a GETATTR request if some of the attributes are no longer valid.  The page
cache is then invalidated if the size or mtime have changed.

Then, if a READ request was sent and reply received (which is the case if
the data wasn't cached yet, or if the file is opened for O_DIRECT), the
atime attribute is invalidated.

This will result in the next read() also triggering a GETATTR, ...

This can be fixed by only sending GETATTR if the mode or size are invalid,
we don't need to do a refresh if only atime is invalid.

More generally, none of the callers of fuse_update_attributes() need an
up-to-date atime value, so for now just remove STATX_ATIME from the request
mask when attributes are updated for internal use.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/fuse/dir.c