From 7bb64d409a1e80276ca6e3270a1aab419d8d8dcf Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Oct 24 2020 03:21:57 +0000 Subject: New upstream v5.9 - Build Python bindings - Drop patches incorporated into this release --- diff --git a/.gitignore b/.gitignore index c8a54ce..e877b82 100644 --- a/.gitignore +++ b/.gitignore @@ -68,3 +68,4 @@ /btrfs-progs-v5.6.1.tar.xz /btrfs-progs-v5.7-rc1.tar.xz /btrfs-progs-v5.7.tar.xz +/btrfs-progs-v5.9.tar.xz diff --git a/0001-btrfs-progs-convert-prevent-32bit-overflow-for-cctx-.patch b/0001-btrfs-progs-convert-prevent-32bit-overflow-for-cctx-.patch deleted file mode 100644 index 6fc0f3f..0000000 --- a/0001-btrfs-progs-convert-prevent-32bit-overflow-for-cctx-.patch +++ /dev/null @@ -1,108 +0,0 @@ -From fe8715e1337a1bad5c49e165ab77c033c334efbc Mon Sep 17 00:00:00 2001 -From: Qu Wenruo -Date: Mon, 20 Jul 2020 20:51:08 +0800 -Subject: [PATCH 1/2] btrfs-progs: convert: prevent 32bit overflow for - cctx->total_bytes - -[BUG] -When convert is called on a 64GiB ext4 fs, it fails like this: - - $ btrfs-convert /dev/loop0p1 - create btrfs filesystem: - blocksize: 4096 - nodesize: 16384 - features: extref, skinny-metadata (default) - checksum: crc32c - creating ext2 image file - ERROR: missing data block for bytenr 1048576 - ERROR: failed to create ext2_saved/image: -2 - WARNING: an error occurred during conversion, filesystem is partially created but not finalized and not mountable - -Btrfs-convert also corrupts the source fs: - - $ LANG=C e2fsck /dev/loop0p1 -f - e2fsck 1.45.6 (20-Mar-2020) - Resize inode not valid. Recreate? yes - Pass 1: Checking inodes, blocks, and sizes - Deleted inode 3681 has zero dtime. Fix? yes - Inodes that were part of a corrupted orphan linked list found. Fix? yes - Inode 3744 was part of the orphaned inode list. FIXED. - Deleted inode 3745 has zero dtime. Fix? yes - Inode 3747 has INLINE_DATA_FL flag on filesystem without inline data support. - Clear? yes - ... - -[CAUSE] -After some debugging, the first strange behavior is, the value of -cctx->total_bytes is 0 in ext2_open_fs(). - -It turns out that, the value assign for cctx->total_bytes could lead to -bit overflow for the unsigned int value. - -And that 0 cctx->total_bytes leads to various problems for later free -space calculation. -For example, in calculate_available_space(), we use cctx->total_bytes to -ensure we won't create a data chunk beyond device end: - - cue_len = min(cctx->total_bytes - cur_off, cur_len); - -If that cur_offset is also 0, we will create a cache_extent with 0 size, -which could cause a lot of problems for cache tree search. - -[FIX] -Do manual casting for the multiply operation, so we could got a real u64 -result. The fix will be applied to all supported fses (ext* and -reiserfs). - -Reported-by: Christian Zangl -Reviewed-by: Nikolay Borisov -Signed-off-by: Qu Wenruo -Signed-off-by: David Sterba -(cherry picked from commit 670a19828ad40004d05ad70cdd45d58008d3fb51) ---- - convert/main.c | 1 + - convert/source-ext2.c | 2 +- - convert/source-reiserfs.c | 2 +- - 3 files changed, 3 insertions(+), 2 deletions(-) - -diff --git a/convert/main.c b/convert/main.c -index 7709e9a6..df6a2ae3 100644 ---- a/convert/main.c -+++ b/convert/main.c -@@ -1136,6 +1136,7 @@ static int do_convert(const char *devname, u32 convert_flags, u32 nodesize, - if (ret) - goto fail; - -+ ASSERT(cctx.total_bytes); - blocksize = cctx.blocksize; - total_bytes = (u64)blocksize * (u64)cctx.block_count; - if (blocksize < 4096) { -diff --git a/convert/source-ext2.c b/convert/source-ext2.c -index f11ef651..d73684ef 100644 ---- a/convert/source-ext2.c -+++ b/convert/source-ext2.c -@@ -87,7 +87,7 @@ static int ext2_open_fs(struct btrfs_convert_context *cctx, const char *name) - cctx->fs_data = ext2_fs; - cctx->blocksize = ext2_fs->blocksize; - cctx->block_count = ext2_fs->super->s_blocks_count; -- cctx->total_bytes = ext2_fs->blocksize * ext2_fs->super->s_blocks_count; -+ cctx->total_bytes = (u64)ext2_fs->super->s_blocks_count * ext2_fs->blocksize; - cctx->volume_name = strndup((char *)ext2_fs->super->s_volume_name, 16); - cctx->first_data_block = ext2_fs->super->s_first_data_block; - cctx->inodes_count = ext2_fs->super->s_inodes_count; -diff --git a/convert/source-reiserfs.c b/convert/source-reiserfs.c -index 9fd6b9ab..3b4cb5ad 100644 ---- a/convert/source-reiserfs.c -+++ b/convert/source-reiserfs.c -@@ -82,7 +82,7 @@ static int reiserfs_open_fs(struct btrfs_convert_context *cxt, const char *name) - cxt->fs_data = fs; - cxt->blocksize = fs->fs_blocksize; - cxt->block_count = get_sb_block_count(fs->fs_ondisk_sb); -- cxt->total_bytes = cxt->blocksize * cxt->block_count; -+ cxt->total_bytes = (u64)cxt->block_count * cxt->blocksize; - cxt->volume_name = strndup(fs->fs_ondisk_sb->s_label, 16); - cxt->first_data_block = 0; - cxt->inodes_count = reiserfs_count_objectids(fs); --- -2.26.2 - diff --git a/0001-btrfs-progs-mkfs-clean-up-default-profile-settings.patch b/0001-btrfs-progs-mkfs-clean-up-default-profile-settings.patch deleted file mode 100644 index f72d0e3..0000000 --- a/0001-btrfs-progs-mkfs-clean-up-default-profile-settings.patch +++ /dev/null @@ -1,79 +0,0 @@ -From fcd0fd043749cd2623a918cf9862d10e2a227ae4 Mon Sep 17 00:00:00 2001 -From: David Sterba -Date: Tue, 21 Jul 2020 12:13:27 +0200 -Subject: [PATCH 1/2] btrfs-progs: mkfs: clean up default profile settings - -Extract the defaults for data and metadata profiles to a header and -use the symbolic names instead of hardcoding the profiles. - -Signed-off-by: David Sterba -(cherry picked from commit 071cb030a41fde2cab07217b52ba7c86b72fb8d8) ---- - mkfs/common.h | 10 ++++++++++ - mkfs/main.c | 21 ++++++++++++++++----- - 2 files changed, 26 insertions(+), 5 deletions(-) - -diff --git a/mkfs/common.h b/mkfs/common.h -index 426852be..61969dcc 100644 ---- a/mkfs/common.h -+++ b/mkfs/common.h -@@ -28,6 +28,16 @@ - #define BTRFS_MKFS_SYSTEM_GROUP_SIZE SZ_4M - #define BTRFS_MKFS_SMALL_VOLUME_SIZE SZ_1G - -+/* -+ * Default settings for block group types -+ */ -+#define BTRFS_MKFS_DEFAULT_DATA_ONE_DEVICE 0 /* SINGLE */ -+#define BTRFS_MKFS_DEFAULT_META_ONE_DEVICE BTRFS_BLOCK_GROUP_DUP -+#define BTRFS_MKFS_DEFAULT_META_ONE_DEVICE_SSD 0 /* SINGLE */ -+ -+#define BTRFS_MKFS_DEFAULT_DATA_MULTI_DEVICE BTRFS_BLOCK_GROUP_RAID0 -+#define BTRFS_MKFS_DEFAULT_META_MULTI_DEVICE BTRFS_BLOCK_GROUP_RAID1 -+ - /* - * Tree root blocks created during mkfs - */ -diff --git a/mkfs/main.c b/mkfs/main.c -index 0a4de617..6c9a24a4 100644 ---- a/mkfs/main.c -+++ b/mkfs/main.c -@@ -1144,19 +1144,30 @@ int BOX_MAIN(mkfs)(int argc, char **argv) - * For mixed groups defaults are single/single. - */ - if (!mixed) { -+ u64 tmp; -+ - if (!metadata_profile_opt) { - if (dev_cnt == 1 && ssd && verbose) - printf("Detected a SSD, turning off metadata " - "duplication. Mkfs with -m dup if you want to " - "force metadata duplication.\n"); - -- metadata_profile = (dev_cnt > 1) ? -- BTRFS_BLOCK_GROUP_RAID1 : (ssd) ? -- 0: BTRFS_BLOCK_GROUP_DUP; -+ if (dev_cnt > 1) { -+ tmp = BTRFS_MKFS_DEFAULT_META_MULTI_DEVICE; -+ } else { -+ if (ssd) -+ tmp = BTRFS_MKFS_DEFAULT_META_ONE_DEVICE_SSD; -+ else -+ tmp = BTRFS_MKFS_DEFAULT_META_ONE_DEVICE; -+ } -+ metadata_profile = tmp; - } - if (!data_profile_opt) { -- data_profile = (dev_cnt > 1) ? -- BTRFS_BLOCK_GROUP_RAID0 : 0; /* raid0 or single */ -+ if (dev_cnt > 1) -+ tmp = BTRFS_MKFS_DEFAULT_DATA_MULTI_DEVICE; -+ else -+ tmp = BTRFS_MKFS_DEFAULT_DATA_ONE_DEVICE; -+ data_profile = tmp; - } - } else { - u32 best_nodesize = max_t(u32, sysconf(_SC_PAGESIZE), sectorsize); --- -2.26.2 - diff --git a/0002-btrfs-progs-mkfs-switch-to-single-as-default-profile.patch b/0002-btrfs-progs-mkfs-switch-to-single-as-default-profile.patch deleted file mode 100644 index aecef39..0000000 --- a/0002-btrfs-progs-mkfs-switch-to-single-as-default-profile.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 5e76619fcda3d792b2cb188fc2d950c61d7ebf09 Mon Sep 17 00:00:00 2001 -From: David Sterba -Date: Tue, 21 Jul 2020 12:28:05 +0200 -Subject: [PATCH 2/2] btrfs-progs: mkfs: switch to single as default profile - for multiple-devices - -The single profile is better suited as default for data on multiple -devices. Switch from RAID0 because: - -- it's easier to convert to other profiles, as single consumes some - chunks per device, but RAID0 has chunks on all devices regardless of - the used space - -- RAID0 has no redundancy and compared one disk failure affects many - files due to striping, while with single the chances are a bit higher - that complete files are stored on one device - -- when the device sizes are not equal and not even close to equal, the - maximum achievable size with RAID0 is size of the smallest device due - to striping, with single it's the sum of all device sizes - -The changed defaults could affect scripts and deployments that rely on -the old values, but given the number of possible profiles for multiple -devices let's hope that they're specified explicitly in majority of -cases. - -Issue: #270 -Signed-off-by: David Sterba -(cherry picked from commit f1507716c67e2d6012f1e7a0f1538d4f669faa23) ---- - mkfs/common.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/mkfs/common.h b/mkfs/common.h -index 61969dcc..cc88db71 100644 ---- a/mkfs/common.h -+++ b/mkfs/common.h -@@ -35,7 +35,7 @@ - #define BTRFS_MKFS_DEFAULT_META_ONE_DEVICE BTRFS_BLOCK_GROUP_DUP - #define BTRFS_MKFS_DEFAULT_META_ONE_DEVICE_SSD 0 /* SINGLE */ - --#define BTRFS_MKFS_DEFAULT_DATA_MULTI_DEVICE BTRFS_BLOCK_GROUP_RAID0 -+#define BTRFS_MKFS_DEFAULT_DATA_MULTI_DEVICE 0 /* SINGLE */ - #define BTRFS_MKFS_DEFAULT_META_MULTI_DEVICE BTRFS_BLOCK_GROUP_RAID1 - - /* --- -2.26.2 - diff --git a/0002-btrfs-progs-tests-add-convert-test-case-for-multiply.patch b/0002-btrfs-progs-tests-add-convert-test-case-for-multiply.patch deleted file mode 100644 index ab5d642..0000000 --- a/0002-btrfs-progs-tests-add-convert-test-case-for-multiply.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 11c4a7b38a6aeef51b075d70e5aca36c42398842 Mon Sep 17 00:00:00 2001 -From: Qu Wenruo -Date: Mon, 20 Jul 2020 20:51:09 +0800 -Subject: [PATCH 2/2] btrfs-progs: tests: add convert test case for multiply - overflow - -The new test case will test whether btrfs-convert can handle 64G ext* -fs. - -This exercise the cctx->total_bytes calculation where multiplying 4K -(unsigned int) and 16777216 (u32) could lead to bit overflow for -unsigned int and got 0, and screw up later free space calculation. - -Signed-off-by: Qu Wenruo -Signed-off-by: David Sterba -(cherry picked from commit 61f41474469b0b0fba9ec1978dfa91d9cbc6c914) ---- - .../018-fs-size-overflow/test.sh | 19 +++++++++++++++++++ - 1 file changed, 19 insertions(+) - create mode 100755 tests/convert-tests/018-fs-size-overflow/test.sh - -diff --git a/tests/convert-tests/018-fs-size-overflow/test.sh b/tests/convert-tests/018-fs-size-overflow/test.sh -new file mode 100755 -index 00000000..d819f695 ---- /dev/null -+++ b/tests/convert-tests/018-fs-size-overflow/test.sh -@@ -0,0 +1,19 @@ -+#!/bin/bash -+# Check if btrfs-convert can handle an ext4 fs whose size is 64G. -+# That fs size could trigger a multiply overflow and screw up free space -+# calculation -+ -+source "$TEST_TOP/common" -+source "$TEST_TOP/common.convert" -+ -+setup_root_helper -+prepare_test_dev 64g -+check_prereq btrfs-convert -+check_global_prereq mke2fs -+ -+convert_test_prep_fs ext4 mke2fs -t ext4 -b 4096 -+run_check_umount_test_dev -+ -+# Unpatched btrfs-convert would fail half way due to corrupted free space -+# cache tree -+convert_test_do_convert --- -2.26.2 - diff --git a/btrfs-progs.spec b/btrfs-progs.spec index 2a8aecd..108df8b 100644 --- a/btrfs-progs.spec +++ b/btrfs-progs.spec @@ -1,12 +1,9 @@ # Local definition of version_no_tilde when it doesn't exist %{!?version_no_tilde: %define version_no_tilde %{shrink:%(echo '%{version}' | tr '~' '-')}} -# Disable for now until version handling question is dealt with -%bcond_with python - Name: btrfs-progs -Version: 5.7 -Release: 5%{?dist} +Version: 5.9 +Release: 1%{?dist} Summary: Userspace programs for btrfs License: GPLv2 @@ -14,22 +11,13 @@ URL: https://btrfs.wiki.kernel.org/index.php/Main_Page Source0: https://www.kernel.org/pub/linux/kernel/people/kdave/%{name}/%{name}-v%{version_no_tilde}.tar.xz # Backports from upstream -## Do not use raid0 by default for mkfs multi-disk (#1855174) -Patch0001: 0001-btrfs-progs-mkfs-clean-up-default-profile-settings.patch -Patch0002: 0002-btrfs-progs-mkfs-switch-to-single-as-default-profile.patch -## Fix convert for 64-bit ext4 filesystems (#1851674) -Patch0003: 0001-btrfs-progs-convert-prevent-32bit-overflow-for-cctx-.patch -Patch0004: 0002-btrfs-progs-tests-add-convert-test-case-for-multiply.patch BuildRequires: gcc, autoconf, automake BuildRequires: e2fsprogs-devel, libuuid-devel, zlib-devel, libzstd-devel BuildRequires: libacl-devel, libblkid-devel, lzo-devel BuildRequires: asciidoc, xmlto BuildRequires: systemd - -%if %{with python} BuildRequires: python3-devel >= 3.4 -%endif %description The btrfs-progs package provides all the userspace programs needed to create, @@ -74,7 +62,6 @@ It includes development files for two libraries: You should install btrfs-progs-devel if you want to develop btrfs filesystem-specific programs. -%if %{with python} %package -n python3-btrfsutil Summary: Python 3 bindings for libbtrfsutil License: LGPLv3 @@ -87,7 +74,6 @@ which can be used for btrfs filesystem-specific programs in Python. You should install python3-btrfsutil if you want to use or develop btrfs filesystem-specific programs in Python. -%endif %prep %autosetup -n %{name}-v%{version_no_tilde} -p1 @@ -97,11 +83,9 @@ btrfs filesystem-specific programs in Python. %configure CFLAGS="%{optflags} -fno-strict-aliasing" %{!?with_python:--disable-python} %make_build -%if %{with python} pushd libbtrfsutil/python %py3_build popd -%endif %install %make_install mandir=%{_mandir} bindir=%{_sbindir} libdir=%{_libdir} incdir=%{_includedir} @@ -109,11 +93,9 @@ install -Dpm0644 btrfs-completion %{buildroot}%{_datadir}/bash-completion/comple # Nuke the static lib rm -v %{buildroot}%{_libdir}/*.a -%if %{with python} pushd libbtrfsutil/python %py3_install popd -%endif %files %license COPYING @@ -127,8 +109,8 @@ popd %{_sbindir}/btrfs %{_sbindir}/btrfs-map-logical %{_sbindir}/btrfs-find-root -%{_mandir}/man5/*.gz -%{_mandir}/man8/*.gz +%{_mandir}/man5/* +%{_mandir}/man8/* %{_udevrulesdir}/64-btrfs-dm.rules %{_datadir}/bash-completion/completions/btrfs @@ -144,15 +126,19 @@ popd %{_includedir}/* %{_libdir}/libbtrfs.so %{_libdir}/libbtrfsutil.so +%{_libdir}/pkgconfig/libbtrfsutil.pc -%if %{with python} %files -n python3-btrfsutil %license libbtrfsutil/COPYING* %{python3_sitearch}/btrfsutil.*.so -%{python3_sitearch}/btrfsutil-*.egg-info -%endif +%{python3_sitearch}/btrfsutil-*.egg-info/ %changelog +* Fri Oct 23 2020 Neal Gompa - 5.9-1 +- New upstream release +- Build Python bindings +- Drop patches incorporated into this release + * Mon Jul 27 2020 Fedora Release Engineering - 5.7-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild diff --git a/sources b/sources index 7a5c799..42b8d47 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (btrfs-progs-v5.7.tar.xz) = 72c3af13ca589f2e0b96cb7602319035ef8aab6ee224fff3544a5d0bfc013a66552dde4533ec5e64696d404b8905431cd0f25367c40fd34ea39be7c0ed8c2d16 +SHA512 (btrfs-progs-v5.9.tar.xz) = 38db047198ab0467d3fe235f7e8e1fd14ade00dd0b182588220c5f5e4b598efbdcd30a3d5d56cf0a0ed8a902d2374af0927eb7f3720cd761172c7291a2a65c94