]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
Btrfs: fix free space tree bitmaps on big-endian systems
authorOmar Sandoval <osandov@fb.com>
Fri, 23 Sep 2016 00:24:20 +0000 (17:24 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 22 Oct 2016 10:06:46 +0000 (12:06 +0200)
commit520f16abf003952def5d6b175c56c2b7d5d5b90f
tree31d269dd2fd32ab70c4a9b3a46fb87efd481d680
parentb5de4b6a6023a6d5d73f671faf1c00ba9aa23dce
Btrfs: fix free space tree bitmaps on big-endian systems

commit 2fe1d55134fce05c17ea118a2e37a4af771887bc upstream.

In convert_free_space_to_{bitmaps,extents}(), we buffer the free space
bitmaps in memory and copy them directly to/from the extent buffers with
{read,write}_extent_buffer(). The extent buffer bitmap helpers use byte
granularity, which is equivalent to a little-endian bitmap. This means
that on big-endian systems, the in-memory bitmaps will be written to
disk byte-swapped. To fix this, use byte-granularity for the bitmaps in
memory.

Fixes: a5ed91828518 ("Btrfs: implement the free space B-tree")
Tested-by: Holger Hoffstätte <holger@applied-asynchrony.com>
Tested-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/extent_io.c
fs/btrfs/extent_io.h
fs/btrfs/free-space-tree.c