aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/fuse/file.c')
-rw-r--r--fs/fuse/file.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 68051f3bdf91..f0f0f278b4ea 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -610,13 +610,24 @@ static int fuse_write_begin(struct file *file, struct address_space *mapping,
610 return 0; 610 return 0;
611} 611}
612 612
613static void fuse_write_update_size(struct inode *inode, loff_t pos)
614{
615 struct fuse_conn *fc = get_fuse_conn(inode);
616 struct fuse_inode *fi = get_fuse_inode(inode);
617
618 spin_lock(&fc->lock);
619 fi->attr_version = ++fc->attr_version;
620 if (pos > inode->i_size)
621 i_size_write(inode, pos);
622 spin_unlock(&fc->lock);
623}
624
613static int fuse_buffered_write(struct file *file, struct inode *inode, 625static int fuse_buffered_write(struct file *file, struct inode *inode,
614 loff_t pos, unsigned count, struct page *page) 626 loff_t pos, unsigned count, struct page *page)
615{ 627{
616 int err; 628 int err;
617 size_t nres; 629 size_t nres;
618 struct fuse_conn *fc = get_fuse_conn(inode); 630 struct fuse_conn *fc = get_fuse_conn(inode);
619 struct fuse_inode *fi = get_fuse_inode(inode);
620 unsigned offset = pos & (PAGE_CACHE_SIZE - 1); 631 unsigned offset = pos & (PAGE_CACHE_SIZE - 1);
621 struct fuse_req *req; 632 struct fuse_req *req;
622 633
@@ -643,12 +654,7 @@ static int fuse_buffered_write(struct file *file, struct inode *inode,
643 err = -EIO; 654 err = -EIO;
644 if (!err) { 655 if (!err) {
645 pos += nres; 656 pos += nres;
646 spin_lock(&fc->lock); 657 fuse_write_update_size(inode, pos);
647 fi->attr_version = ++fc->attr_version;
648 if (pos > inode->i_size)
649 i_size_write(inode, pos);
650 spin_unlock(&fc->lock);
651
652 if (count == PAGE_CACHE_SIZE) 658 if (count == PAGE_CACHE_SIZE)
653 SetPageUptodate(page); 659 SetPageUptodate(page);
654 } 660 }
@@ -766,12 +772,8 @@ static ssize_t fuse_direct_io(struct file *file, const char __user *buf,
766 } 772 }
767 fuse_put_request(fc, req); 773 fuse_put_request(fc, req);
768 if (res > 0) { 774 if (res > 0) {
769 if (write) { 775 if (write)
770 spin_lock(&fc->lock); 776 fuse_write_update_size(inode, pos);
771 if (pos > inode->i_size)
772 i_size_write(inode, pos);
773 spin_unlock(&fc->lock);
774 }
775 *ppos = pos; 777 *ppos = pos;
776 } 778 }
777 fuse_invalidate_attr(inode); 779 fuse_invalidate_attr(inode);