]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
Btrfs: fix missing i_size update
authorJosef Bacik <jbacik@fusionio.com>
Wed, 30 Jan 2013 19:17:31 +0000 (14:17 -0500)
committerJosef Bacik <jbacik@fusionio.com>
Tue, 5 Feb 2013 21:09:14 +0000 (16:09 -0500)
If we have an ordered extent before the ordered extent we are currently
completing that is after the current disk_i_size we will put our i_size
update into that ordered extent so that we do not expose stale data.  The
problem is that if our disk i_size is updated past the previous ordered
extent we won't update the i_size with the pending i_size update.  So check
the pending i_size update and if its above the current disk i_size we need
to go ahead and try to update.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
fs/btrfs/ordered-data.c

index f107312970405da1e3218118a8d0555894955c59..fc6840b53d9d0f70bdefe376cabc95e521e3e320 100644 (file)
@@ -836,9 +836,16 @@ int btrfs_ordered_update_i_size(struct inode *inode, u64 offset,
         * if the disk i_size is already at the inode->i_size, or
         * this ordered extent is inside the disk i_size, we're done
         */
-       if (disk_i_size == i_size || offset <= disk_i_size) {
+       if (disk_i_size == i_size)
+               goto out;
+
+       /*
+        * We still need to update disk_i_size if outstanding_isize is greater
+        * than disk_i_size.
+        */
+       if (offset <= disk_i_size &&
+           (!ordered || ordered->outstanding_isize <= disk_i_size))
                goto out;
-       }
 
        /*
         * walk backward from this ordered extent to disk_i_size.