A fuse-based network filesystem might allow for the inode and/or file data to change unexpectedly. A local client that opens and repeatedly reads a file might never pick up on such changes and indefinitely return stale data. Always invoke fuse_update_attributes() in the read path to cause an attr revalidation when the attributes expire. This leads to a page cache invalidation if necessary and ensures fuse issues new read requests to the fuse client. Signed-off-by: Brian Foster <bfoster at redhat.com> --- fs/fuse/file.c | 14 ++++---------- 1 files changed, 4 insertions(+), 10 deletions(-) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index b321a68..0bb01bd 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -702,18 +702,12 @@ out: static ssize_t fuse_file_aio_read(struct kiocb *iocb, const struct iovec *iov, unsigned long nr_segs, loff_t pos) { + int err; struct inode *inode = iocb->ki_filp->f_mapping->host; - if (pos + iov_length(iov, nr_segs) > i_size_read(inode)) { - int err; - /* - * If trying to read past EOF, make sure the i_size - * attribute is up-to-date. - */ - err = fuse_update_attributes(inode, NULL, iocb->ki_filp, NULL); - if (err) - return err; - } + err = fuse_update_attributes(inode, NULL, iocb->ki_filp, NULL); + if (err) + return err; return generic_file_aio_read(iocb, iov, nr_segs, pos); } -- 1.7.7.6 --------------020509060500050103080303--