]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
Btrfs: make sure new inode size is ok in fallocate
authorJosef Bacik <josef@redhat.com>
Mon, 22 Nov 2010 18:55:39 +0000 (18:55 +0000)
committerChris Mason <chris.mason@oracle.com>
Sat, 27 Nov 2010 18:00:07 +0000 (13:00 -0500)
We have been failing xfstest 228 forever, because we don't check to make sure
the new inode size is acceptable as far as RLIMIT is concerned.  Just check to
make sure it's ok to create a inode with this new size and error out if not.
With this patch we now pass 228.

Signed-off-by: Josef Bacik <josef@redhat.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/inode.c

index 0058fb3c2561a46b5710a2dcad5354ad1cac5c49..0eeacd93e8e5e659c923fef2995c9bc755d8e64b 100644 (file)
@@ -7102,6 +7102,10 @@ static long btrfs_fallocate(struct inode *inode, int mode,
        btrfs_wait_ordered_range(inode, alloc_start, alloc_end - alloc_start);
 
        mutex_lock(&inode->i_mutex);
+       ret = inode_newsize_ok(inode, alloc_end);
+       if (ret)
+               goto out;
+
        if (alloc_start > inode->i_size) {
                ret = btrfs_cont_expand(inode, alloc_start);
                if (ret)