]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
Btrfs: fix possible stale data exposure
authorJosef Bacik <jbacik@fusionio.com>
Wed, 30 Jan 2013 19:31:31 +0000 (14:31 -0500)
committerJosef Bacik <jbacik@fusionio.com>
Tue, 5 Feb 2013 21:09:16 +0000 (16:09 -0500)
We specifically do not update the disk i_size if there are ordered extents
outstanding for any area between the current disk_i_size and our ordered
extent so that we do not expose stale data.  The problem is the check we
have only checks if the ordered extent starts at or after the current
disk_i_size, which doesn't take into account an ordered extent that starts
before the current disk_i_size and ends past the disk_i_size.  Fix this by
checking if the extent ends past the disk_i_size.  Thanks,

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

index fc6840b53d9d0f70bdefe376cabc95e521e3e320..e5ed56729607a82246cac22a229d105efa562509 100644 (file)
@@ -877,7 +877,7 @@ int btrfs_ordered_update_i_size(struct inode *inode, u64 offset,
                        break;
                if (test->file_offset >= i_size)
                        break;
-               if (test->file_offset >= disk_i_size) {
+               if (entry_end(test) > disk_i_size) {
                        /*
                         * we don't update disk_i_size now, so record this
                         * undealt i_size. Or we will not know the real