Accepting request 331680 from home:dsterba:branches:filesystems

- make mkfs work with 64k nodesize again, notably fixes mkfs on ppc64 (bsc#945229)

OBS-URL: https://build.opensuse.org/request/show/331680
OBS-URL: https://build.opensuse.org/package/show/filesystems/btrfsprogs?expand=0&rev=212
This commit is contained in:
David Sterba 2015-09-17 11:45:34 +00:00 committed by Git OBS Bridge
parent 462f936217
commit 362fb5a18e
3 changed files with 63 additions and 0 deletions

View File

@ -0,0 +1,52 @@
From 73a894e51e5bcea9fddc4f3ded37d0ad81456e92 Mon Sep 17 00:00:00 2001
From: David Sterba <dsterba@suse.com>
Date: Thu, 10 Sep 2015 16:36:04 +0200
Subject: [PATCH] btrfs-progs: fix cross stripe boundary check
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Commit 854437ca3c228d8ab3eb24d2efc1c21b5d56a635 ("btrfs-progs:
extent-tree: avoid allocating tree block that crosses stripe boundary")
does not work for 64k nodesize. Due to an off-by-one error, all queries
to check_crossing_stripes will return that all extents cross a stripe
and this will lead to a false ENOSPC. This crashes later
$ ./mkfs.btrfs -n 64k image
./mkfs.btrfs(btrfs_reserve_extent+0xb77)[0x417f38]
./mkfs.btrfs(btrfs_alloc_free_block+0x57)[0x417fe0]
./mkfs.btrfs(__btrfs_cow_block+0x163)[0x408eb7]
./mkfs.btrfs(btrfs_cow_block+0xd0)[0x4097c4]
./mkfs.btrfs(btrfs_search_slot+0x16f)[0x40be4d]
./mkfs.btrfs(btrfs_insert_empty_items+0xc0)[0x40d5f9]
./mkfs.btrfs(btrfs_insert_item+0x99)[0x40da5f]
./mkfs.btrfs(btrfs_make_block_group+0x4d)[0x41705c]
./mkfs.btrfs(main+0xeef)[0x434b56]
Holger Hoffstätte reports that this also fixes false positives in case
the nodesize is less than 64k. This happens when the node blocks end at
the stripe boundary.
Reviewed-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
---
volumes.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/volumes.h b/volumes.h
index f7761311e8ce..4ecb99314a0c 100644
--- a/volumes.h
+++ b/volumes.h
@@ -156,7 +156,7 @@ struct map_lookup {
static inline int check_crossing_stripes(u64 start, u64 len)
{
return (start / BTRFS_STRIPE_LEN) !=
- ((start + len) / BTRFS_STRIPE_LEN);
+ ((start + len - 1) / BTRFS_STRIPE_LEN);
}
int __btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw,
--
2.1.3

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Thu Sep 17 00:00:00 CEST 2015 - dsterba@suse.cz
- make mkfs work with 64k nodesize again, notably fixes mkfs on ppc64
(bsc#945229)
- Added patch:
* 0001-btrfs-progs-fix-cross-stripe-boundary-check.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Sep 3 00:00:00 CEST 2015 - dsterba@suse.cz Thu Sep 3 00:00:00 CEST 2015 - dsterba@suse.cz

View File

@ -30,6 +30,8 @@ Source: https://www.kernel.org/pub/linux/kernel/people/kdave/btrfs-progs
Source1: boot-btrfs.sh Source1: boot-btrfs.sh
Source4: setup-btrfs.sh Source4: setup-btrfs.sh
Patch1: 0001-btrfs-progs-fix-cross-stripe-boundary-check.patch
Patch163: 0163-btrfs-progs-fsck-fix-segfault.patch Patch163: 0163-btrfs-progs-fsck-fix-segfault.patch
Patch167: 0167-Btrfs-progs-make-find_and_setup_root-return-an-error.patch Patch167: 0167-Btrfs-progs-make-find_and_setup_root-return-an-error.patch
Patch168: 0168-Btrfs-progs-don-t-bug-out-if-we-can-t-find-the-last-.patch Patch168: 0168-Btrfs-progs-don-t-bug-out-if-we-can-t-find-the-last-.patch
@ -79,6 +81,7 @@ build applications to interface with btrfs.
%prep %prep
%setup -q -n btrfs-progs-v%{version} %setup -q -n btrfs-progs-v%{version}
%patch1 -p1
%patch163 -p1 %patch163 -p1
%patch167 -p1 %patch167 -p1
%patch168 -p1 %patch168 -p1