summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorQu Wenruo <quwenruo@cn.fujitsu.com>2015-10-29 17:28:46 +0800
committerChris Mason <clm@fb.com>2015-11-03 07:44:20 -0800
commit485290a734f14279fa9376b3d6021a2dc1f82356 (patch)
treee9c10f2e1fcbb2e86ee66d1af947a8c6b8b7abe0 /fs
parent90ce321da8ce3d00e19586993887346286208386 (diff)
downloadlinux-485290a734f14279fa9376b3d6021a2dc1f82356.tar.gz
linux-485290a734f14279fa9376b3d6021a2dc1f82356.tar.bz2
linux-485290a734f14279fa9376b3d6021a2dc1f82356.zip
btrfs: Fix a data space underflow warning
Even with quota disabled, generic/127 will trigger a kernel warning by underflow data space info. The bug is caused by buffered write, which in case of short copy, the start parameter for btrfs_delalloc_release_space() is wrong, and round_up/down() in btrfs_delalloc_release() extents the range to page aligned, decreasing one more page than expected. This patch will fix it by passing correct start. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/file.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 381be79f779a..e6df6f1b13dd 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1604,12 +1604,17 @@ again:
BTRFS_I(inode)->outstanding_extents++;
spin_unlock(&BTRFS_I(inode)->lock);
}
- if (only_release_metadata)
+ if (only_release_metadata) {
btrfs_delalloc_release_metadata(inode,
release_bytes);
- else
- btrfs_delalloc_release_space(inode, pos,
+ } else {
+ u64 __pos;
+
+ __pos = round_down(pos, root->sectorsize) +
+ (dirty_pages << PAGE_CACHE_SHIFT);
+ btrfs_delalloc_release_space(inode, __pos,
release_bytes);
+ }
}
release_bytes = dirty_pages << PAGE_CACHE_SHIFT;