diff options
author | Miao Xie <miaox@cn.fujitsu.com> | 2012-09-06 04:04:57 -0600 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2012-10-01 15:19:14 -0400 |
commit | 903889f462409c816893abd02d88636f7b4a7774 (patch) | |
tree | 842dce20600c595ede74678ea259a872c86dd12b | |
parent | 69ce977a179750915e04fcc12bfbe33e6c8f5132 (diff) | |
download | kernel_goldelico_gta04-903889f462409c816893abd02d88636f7b4a7774.zip kernel_goldelico_gta04-903889f462409c816893abd02d88636f7b4a7774.tar.gz kernel_goldelico_gta04-903889f462409c816893abd02d88636f7b4a7774.tar.bz2 |
Btrfs: fix wrong size for the reservation when doing, file pre-allocation.
When we ran fsstress(a program in xfstests), the filesystem hung up when it
is full. It was because the space reserved in btrfs_fallocate() was wrong,
btrfs_fallocate() just used the size of the pre-allocation to reserve the
space, didn't took the block size aligning into account, so the size of
the reserved space was less than the allocated space, it caused the over
reserve problem and made the filesystem hung up when invoking cow_file_range().
Fix it.
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
-rw-r--r-- | fs/btrfs/file.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 793bc89..00279c9 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -2000,7 +2000,7 @@ static long btrfs_fallocate(struct file *file, int mode, * Make sure we have enough space before we do the * allocation. */ - ret = btrfs_check_data_free_space(inode, len); + ret = btrfs_check_data_free_space(inode, alloc_end - alloc_start + 1); if (ret) return ret; @@ -2107,7 +2107,7 @@ static long btrfs_fallocate(struct file *file, int mode, out: mutex_unlock(&inode->i_mutex); /* Let go of our reservation. */ - btrfs_free_reserved_data_space(inode, len); + btrfs_free_reserved_data_space(inode, alloc_end - alloc_start + 1); return ret; } |