Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi...
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 16 Aug 2012 18:46:31 +0000 (11:46 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 16 Aug 2012 18:46:31 +0000 (11:46 -0700)
Pull fuse updates from Miklos Szeredi.

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse:
  fuse: verify all ioctl retry iov elements
  fuse: add missing INIT flag descriptions
  fuse: add missing INIT flags
  fuse: update attributes on aio_read
  fuse: invalidate inode mapping if mtime changes
  fuse: add FUSE_AUTO_INVAL_DATA init flag

1  2 
fs/fuse/file.c

diff --combined fs/fuse/file.c
index 93d8d6c9494dbd5737b0842a3ebb55ef972e0d87,2eed3acfb6a6b3bb9741194f88eba5522c3abda3..aba15f1b7ad2974aa85e2c7272afc3d7836a40bc
@@@ -703,13 -703,16 +703,16 @@@ static ssize_t fuse_file_aio_read(struc
                                  unsigned long nr_segs, loff_t pos)
  {
        struct inode *inode = iocb->ki_filp->f_mapping->host;
+       struct fuse_conn *fc = get_fuse_conn(inode);
  
-       if (pos + iov_length(iov, nr_segs) > i_size_read(inode)) {
+       /*
+        * In auto invalidate mode, always update attributes on read.
+        * Otherwise, only update if we attempt to read past EOF (to ensure
+        * i_size is up to date).
+        */
+       if (fc->auto_inval_data ||
+           (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;
@@@ -944,8 -947,9 +947,8 @@@ static ssize_t fuse_file_aio_write(stru
                return err;
  
        count = ocount;
 -
 +      sb_start_write(inode->i_sb);
        mutex_lock(&inode->i_mutex);
 -      vfs_check_frozen(inode->i_sb, SB_FREEZE_WRITE);
  
        /* We can write back this queue in page reclaim */
        current->backing_dev_info = mapping->backing_dev_info;
  out:
        current->backing_dev_info = NULL;
        mutex_unlock(&inode->i_mutex);
 +      sb_end_write(inode->i_sb);
  
        return written ? written : err;
  }
@@@ -1700,7 -1703,7 +1703,7 @@@ static int fuse_verify_ioctl_iov(struc
        size_t n;
        u32 max = FUSE_MAX_PAGES_PER_REQ << PAGE_SHIFT;
  
-       for (n = 0; n < count; n++) {
+       for (n = 0; n < count; n++, iov++) {
                if (iov->iov_len > (size_t) max)
                        return -ENOMEM;
                max -= iov->iov_len;