diff options
Diffstat (limited to 'fs/fuse/file.c')
-rw-r--r-- | fs/fuse/file.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 535b37399009..474968fbb555 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -453,6 +453,25 @@ out: | |||
453 | return err; | 453 | return err; |
454 | } | 454 | } |
455 | 455 | ||
456 | static ssize_t fuse_file_aio_read(struct kiocb *iocb, const struct iovec *iov, | ||
457 | unsigned long nr_segs, loff_t pos) | ||
458 | { | ||
459 | struct inode *inode = iocb->ki_filp->f_mapping->host; | ||
460 | |||
461 | if (pos + iov_length(iov, nr_segs) > i_size_read(inode)) { | ||
462 | int err; | ||
463 | /* | ||
464 | * If trying to read past EOF, make sure the i_size | ||
465 | * attribute is up-to-date. | ||
466 | */ | ||
467 | err = fuse_update_attributes(inode, NULL, iocb->ki_filp, NULL); | ||
468 | if (err) | ||
469 | return err; | ||
470 | } | ||
471 | |||
472 | return generic_file_aio_read(iocb, iov, nr_segs, pos); | ||
473 | } | ||
474 | |||
456 | static void fuse_write_fill(struct fuse_req *req, struct fuse_file *ff, | 475 | static void fuse_write_fill(struct fuse_req *req, struct fuse_file *ff, |
457 | struct inode *inode, loff_t pos, size_t count, | 476 | struct inode *inode, loff_t pos, size_t count, |
458 | int writepage) | 477 | int writepage) |
@@ -887,7 +906,7 @@ static sector_t fuse_bmap(struct address_space *mapping, sector_t block) | |||
887 | static const struct file_operations fuse_file_operations = { | 906 | static const struct file_operations fuse_file_operations = { |
888 | .llseek = generic_file_llseek, | 907 | .llseek = generic_file_llseek, |
889 | .read = do_sync_read, | 908 | .read = do_sync_read, |
890 | .aio_read = generic_file_aio_read, | 909 | .aio_read = fuse_file_aio_read, |
891 | .write = do_sync_write, | 910 | .write = do_sync_write, |
892 | .aio_write = generic_file_aio_write, | 911 | .aio_write = generic_file_aio_write, |
893 | .mmap = fuse_file_mmap, | 912 | .mmap = fuse_file_mmap, |