diff --git a/srcpkgs/btrfs-progs/patches/6134973527a87a27b2cd9a41c8347fd4bdb74016.patch b/srcpkgs/btrfs-progs/patches/6134973527a87a27b2cd9a41c8347fd4bdb74016.patch new file mode 100644 index 00000000000..22ba4b27683 --- /dev/null +++ b/srcpkgs/btrfs-progs/patches/6134973527a87a27b2cd9a41c8347fd4bdb74016.patch @@ -0,0 +1,56 @@ +From 6134973527a87a27b2cd9a41c8347fd4bdb74016 Mon Sep 17 00:00:00 2001 +From: David Sterba +Date: Mon, 7 Jun 2021 17:38:46 +0200 +Subject: [PATCH] btrfs-progs: zoned: make it work without kernel support + +There's a report that a system with 4.19 kernel fails boot because +device scan exits with error. This is because zoned support is compiled +in btrfs-progs but not in kernel. + +To make new progs and old kernels work, do a fallback when the zoned +ioctl is not available, as if it were a non-zoned device. There is no +other option, but this is safe at least for the device scan that would +not error out. Any unaligned writes to a zoned device will fail as +expected. + +Issue: #376 +Signed-off-by: David Sterba +--- + kernel-shared/zoned.c | 17 +++++++++++++---- + 1 file changed, 13 insertions(+), 4 deletions(-) + +diff --git a/kernel-shared/zoned.c b/kernel-shared/zoned.c +index 2a6892b3c..dc850cd22 100644 +--- a/kernel-shared/zoned.c ++++ b/kernel-shared/zoned.c +@@ -488,9 +488,14 @@ size_t btrfs_sb_io(int fd, void *buf, off_t offset, int rw) + /* Do not call ioctl(BLKGETZONESZ) on a regular file. */ + if ((stat_buf.st_mode & S_IFMT) == S_IFBLK) { + ret = ioctl(fd, BLKGETZONESZ, &zone_size_sector); +- if (ret) { +- error("zoned: ioctl BLKGETZONESZ failed (%m)"); +- exit(1); ++ if (ret < 0) { ++ if (errno == ENOTTY) { ++ /* No kernel support, assuming non-zoned device */ ++ zone_size_sector = 0; ++ } else { ++ error("zoned: ioctl BLKGETZONESZ failed: %m"); ++ exit(1); ++ } + } + } else { + zone_size_sector = 0; +@@ -528,7 +533,11 @@ size_t btrfs_sb_io(int fd, void *buf, off_t offset, int rw) + + ret = ioctl(fd, BLKREPORTZONE, rep); + if (ret) { +- error("zoned: ioctl BLKREPORTZONE failed (%m)"); ++ if (errno == ENOTTY) { ++ error("zoned: BLKREPORTZONE failed but BLKGETZONESZ works: %m"); ++ exit(1); ++ } ++ error("zoned: ioctl BLKREPORTZONE failed: %m"); + exit(1); + } + if (rep->nr_zones != 2) { diff --git a/srcpkgs/btrfs-progs/template b/srcpkgs/btrfs-progs/template index c159c864fde..eeca5301f9f 100644 --- a/srcpkgs/btrfs-progs/template +++ b/srcpkgs/btrfs-progs/template @@ -1,9 +1,7 @@ # Template file for 'btrfs-progs' -# XXX: >=5.12 moves to LGPL-2.1-or-later pkgname=btrfs-progs -reverts="5.12.1_1" -version=5.11.1 -revision=1 +version=5.12.1 +revision=2 wrksrc="${pkgname}-v${version}" build_style=gnu-configure make_check_target=test @@ -14,11 +12,11 @@ makedepends="acl-devel libzstd-devel lzo-devel libblkid-devel libuuid-devel zlib-devel" short_desc="Btrfs filesystem utilities" maintainer="Enno Boland " -license="GPL-2.0-only, LGPL-3.0-or-later" +license="GPL-2.0-only, LGPL-2.1-or-later" homepage="https://btrfs.wiki.kernel.org/index.php/Main_Page" changelog="https://raw.githubusercontent.com/kdave/btrfs-progs/master/CHANGES" distfiles="${KERNEL_SITE}/kernel/people/kdave/${pkgname}/${pkgname}-v${version}.tar.xz" -checksum=e3aaccc4756ec4e5502cb2a9f85b67d52896644f4c3c0f88a6bc598c70bdebfe +checksum=950846fea454fb4b1c39f0fa454983644572df91df5c06047b335bf2d5473759 # Most of the tests depend on `mount` and `fallocate` commands, which are not # presented in chroot-util-linux make_check=no