]> git.hungrycats.org Git - linux/commitdiff
Revert "btrfs: use correct size for memset", "btrfs: do not rely on
authorZygo Blaxell <zblaxell@thirteen.furryterror.org>
Tue, 11 Oct 2016 22:34:58 +0000 (18:34 -0400)
committerZygo Blaxell <zblaxell@thirteen.furryterror.org>
Tue, 11 Oct 2016 23:12:30 +0000 (19:12 -0400)
decompress to zero end of buffer", and "btrfs: fix data corruption while
reading compressed inline extents followed by other extents"

This reverts commit 1532b56af902d6c3381a7c7010606e968c13a08e,
d688d624c257d58b1f67382e462e5a3ead12e501, and
04245be438433703068369edd5465fd1e8bcb09c.

fs/btrfs/inode.c

index 58cfbcecfeea1939e372ec851151bb9360a26f7d..a39eaa894ddd2ac2de07819355615be8813b30ac 100644 (file)
@@ -6762,18 +6762,9 @@ static noinline int uncompress_inline(struct btrfs_path *path,
 
        read_extent_buffer(leaf, tmp, ptr, inline_size);
 
+       max_size = min_t(unsigned long, PAGE_CACHE_SIZE, max_size);
        ret = btrfs_decompress(compress_type, tmp, page,
                               extent_offset, inline_size, max_size);
-       /*
-        * Zero out any bytes at the end of the extent.  This does not
-        * happen often, but it does happen.
-        */
-       WARN_ON(max_size > PAGE_CACHE_SIZE);
-       if (max_size < PAGE_CACHE_SIZE) {
-               char *map = kmap(page);
-               memset(map + max_size, 0, PAGE_CACHE_SIZE - max_size);
-               kunmap(page);
-       }
        kfree(tmp);
        return ret;
 }