btrfs-progs: update to 5.13.1

This commit is contained in:
FollieHiyuki 2021-07-24 18:35:41 +03:00 committed by Érico Nogueira Rolim
parent 55e42d605e
commit 7942830b22
2 changed files with 3 additions and 59 deletions

View File

@ -1,56 +0,0 @@
From 6134973527a87a27b2cd9a41c8347fd4bdb74016 Mon Sep 17 00:00:00 2001
From: David Sterba <dsterba@suse.com>
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 <dsterba@suse.com>
---
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) {

View File

@ -1,7 +1,7 @@
# Template file for 'btrfs-progs'
pkgname=btrfs-progs
version=5.12.1
revision=2
version=5.13.1
revision=1
wrksrc="${pkgname}-v${version}"
build_style=gnu-configure
make_check_target=test
@ -16,7 +16,7 @@ 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=950846fea454fb4b1c39f0fa454983644572df91df5c06047b335bf2d5473759
checksum=3d7e5a01e68fbaf485c5f1da15c6b8a7d1455fb57b6e75a706f8e2bb37f4f399
# Most of the tests depend on `mount` and `fallocate` commands, which are not
# presented in chroot-util-linux
make_check=no