summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2017-04-12 21:59:01 -0700
committerDan Williams <dan.j.williams@intel.com>2017-04-12 21:59:01 -0700
commitbfca9acf1a5df0ff98fbf47e363adb48612bb7ec (patch)
treea50287c88fdc60a73912d205d7bce41b7af53827 /fs/btrfs/inode.c
parent92a3fa075d3d2716b9c662814540f1d660cbf2f5 (diff)
parent11e63f6d920d6f2dfd3cd421e939a4aec9a58dcd (diff)
downloadlinux-bfca9acf1a5df0ff98fbf47e363adb48612bb7ec.tar.bz2
Merge branch 'for-4.11/libnvdimm' into for-4.12/dax
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index c40060cc481f..231503935652 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6709,6 +6709,20 @@ static noinline int uncompress_inline(struct btrfs_path *path,
max_size = min_t(unsigned long, PAGE_SIZE, max_size);
ret = btrfs_decompress(compress_type, tmp, page,
extent_offset, inline_size, max_size);
+
+ /*
+ * decompression code contains a memset to fill in any space between the end
+ * of the uncompressed data and the end of max_size in case the decompressed
+ * data ends up shorter than ram_bytes. That doesn't cover the hole between
+ * the end of an inline extent and the beginning of the next block, so we
+ * cover that region here.
+ */
+
+ if (max_size + pg_offset < PAGE_SIZE) {
+ char *map = kmap(page);
+ memset(map + pg_offset + max_size, 0, PAGE_SIZE - max_size - pg_offset);
+ kunmap(page);
+ }
kfree(tmp);
return ret;
}