Unionfs: update our inode size correctly upon partial write
authorErez Zadok <ezk@cs.sunysb.edu>
Sun, 25 Nov 2007 23:32:31 +0000 (18:32 -0500)
committerErez Zadok <ezk@cs.sunysb.edu>
Sun, 25 Nov 2007 23:32:31 +0000 (18:32 -0500)
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
fs/unionfs/mmap.c

index 9553dac4996b4c258057ab3d211d92cbc9a63812..21d0a55313c7dc9a266b3a0505da3af037b277d4 100644 (file)
@@ -282,7 +282,6 @@ static int unionfs_commit_write(struct file *file, struct page *page,
        int err = -ENOMEM;
        struct inode *inode, *lower_inode;
        struct file *lower_file = NULL;
-       loff_t pos;
        unsigned bytes = to - from;
        char *page_data = NULL;
        mm_segment_t old_fs;
@@ -325,12 +324,8 @@ static int unionfs_commit_write(struct file *file, struct page *page,
        if (err < 0)
                goto out;
 
-       inode->i_blocks = lower_inode->i_blocks;
-       /* we may have to update i_size */
-       pos = page_offset(page) + to;
-       if (pos > i_size_read(inode))
-               i_size_write(inode, pos);
-       /* if vfs_write succeeded above, sync up our times */
+       /* if vfs_write succeeded above, sync up our times/sizes */
+       fsstack_copy_inode_size(inode, lower_inode);
        unionfs_copy_attr_times(inode);
        mark_inode_dirty_sync(inode);