From 9bbb1cf1f23c0a961c6ff0379ea92bcbf4de24b2 Mon Sep 17 00:00:00 2001 From: liuh Date: Thu, 6 Jun 2024 15:14:47 +0800 Subject: [PATCH] btrfs-progs: scrub status: only report limits if at least one exists (cherry picked from commit 2e0c469c69b41de2d417987eb9ea312f84a3a4d9) --- ...b-status-only-report-limits-if-at-le.patch | 59 +++++++++++++++++++ btrfs-progs.spec | 6 +- 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 0004-btrfs-progs-scrub-status-only-report-limits-if-at-le.patch diff --git a/0004-btrfs-progs-scrub-status-only-report-limits-if-at-le.patch b/0004-btrfs-progs-scrub-status-only-report-limits-if-at-le.patch new file mode 100644 index 0000000..2f7d24e --- /dev/null +++ b/0004-btrfs-progs-scrub-status-only-report-limits-if-at-le.patch @@ -0,0 +1,59 @@ +From 8bca55d1e75d23a6fbb942ebd0525e105b982d9b Mon Sep 17 00:00:00 2001 +From: Jonas Malaco +Date: Mon, 15 Jan 2024 08:17:38 -0300 +Subject: [PATCH] btrfs-progs: scrub status: only report limits if at least one + exists + +On multi-device filesystems, scrub status should report "some limits +set" if at least one device has a scrub limit set. + +However, with btrfs-progs 6.6.3, this was being reported regardless of +whether any limit actually being set: + + # sudo btrfs scrub limit /more/butter + UUID: 989129d9-c96f-4d52-9d68-cbb6d9b2c499 + Id Limit Path + -- ----- --------- + 1 - /dev/sdc1 + 2 - /dev/sdd1 + + # sudo btrfs scrub status /more/butter/ + UUID: 989129d9-c96f-4d52-9d68-cbb6d9b2c499 + Scrub started: Mon Jan 15 02:00:30 2024 + Status: running + Duration: 6:23:19 + Time left: 0:49:08 + ETA: Mon Jan 15 09:12:57 2024 + Total to scrub: 9.83TiB + Bytes scrubbed: 8.72TiB (88.64%) + Rate: 397.47MiB/s (some device limits set) + Error summary: no errors found + +Fix it by only setting `limit` to the special marker value 1 if at least +one actual limit is found. + +Pull-request: #733 +Issue: #727 +Fixes: 7e4a235df1ac ("btrfs-progs: scrub status: print device speed limit in status if set") +Signed-off-by: Jonas Malaco +Signed-off-by: David Sterba +--- + cmds/scrub.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/cmds/scrub.c b/cmds/scrub.c +index acff1c0..3601713 100644 +--- a/cmds/scrub.c ++++ b/cmds/scrub.c +@@ -387,7 +387,7 @@ static void print_fs_stat(struct scrub_fs_stat *fs_stat, int raw, u64 bytes_tota + * Limit for the whole filesystem stats does not make sense, + * but if there's any device with a limit then print it. + */ +- if (nr_devices != 1) ++ if (nr_devices != 1 && limit) + limit = 1; + print_scrub_summary(&fs_stat->p, &fs_stat->s, bytes_total, limit); + } +-- +2.27.0 + diff --git a/btrfs-progs.spec b/btrfs-progs.spec index cf469be..97f6542 100644 --- a/btrfs-progs.spec +++ b/btrfs-progs.spec @@ -1,6 +1,6 @@ Name: btrfs-progs Version: 6.6.3 -Release: 4 +Release: 5 Summary: btrfs userspace programs License: GPLv2 and GPL+ and LGPL-2.1+ and GPL-3.0+ and LGPL-2.1 and MIT URL: https://btrfs.wiki.kernel.org/index.php/Main_Page @@ -9,6 +9,7 @@ Source0: https://www.kernel.org/pub/linux/kernel/people/kdave/%{name}/%{name} Patch0001: 0001-fix-exclusive-op-enqueue-timeout.patch Patch0002: 0002-subvolume-fix-return-value-when-the-target-exists.patch Patch0003: 0003-fix-memory-leak-on-exit-path-in-table-vprintf.patch +Patch0004: 0004-btrfs-progs-scrub-status-only-report-limits-if-at-le.patch BuildRequires: python3-devel >= 3.4 BuildRequires: libacl-devel, e2fsprogs-devel, libblkid-devel, libuuid-devel, zlib-devel, libzstd-devel, lzo-devel, systemd-devel @@ -74,6 +75,9 @@ make mandir=%{_mandir} bindir=%{_sbindir} libdir=%{_libdir} incdir=%{_includedir %{_mandir}/man8/*.gz %changelog +* Thu Jun 6 2024 liuh - 6.6.3-5 +- backport patch from community + * Wed May 22 2024 Deyuan Fan - 6.6.3-4 - btrfs-progs: string-table: fix memory leak on exit path in table_vprintf() -- Gitee