From 98247a17df3e6ee3ba32931b3e8e5cc9f6b6293a Mon Sep 17 00:00:00 2001 From: xuchenchen Date: Mon, 3 Nov 2025 16:41:50 +0800 Subject: [PATCH] xfs_scrub: fix reporting if we can't open raw block devices --- ...porting-if-we-can-t-open-raw-block-d.patch | 59 +++++++++++++++++++ xfsprogs.spec | 6 +- 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 0048-xfs_scrub-fix-reporting-if-we-can-t-open-raw-block-d.patch diff --git a/0048-xfs_scrub-fix-reporting-if-we-can-t-open-raw-block-d.patch b/0048-xfs_scrub-fix-reporting-if-we-can-t-open-raw-block-d.patch new file mode 100644 index 0000000..0a993ca --- /dev/null +++ b/0048-xfs_scrub-fix-reporting-if-we-can-t-open-raw-block-d.patch @@ -0,0 +1,59 @@ +From d6febe33bf060d37c37f689c5b7a6c58af6afc97 Mon Sep 17 00:00:00 2001 +From: "Darrick J. Wong" +Date: Mon, 28 Feb 2022 16:47:43 -0500 +Subject: xfs_scrub: fix reporting if we can't open raw block devices + +The error checking logic for opening the data, log, and rt device is +totally broken. Fix this. + +Signed-off-by: Darrick J. Wong +Reviewed-by: Christoph Hellwig +Signed-off-by: Eric Sandeen +--- + scrub/phase1.c | 20 +++++++++++--------- + 1 file changed, 11 insertions(+), 9 deletions(-) + +diff --git a/scrub/phase1.c b/scrub/phase1.c +index 4f02824..fd1050c 100644 +--- a/scrub/phase1.c ++++ b/scrub/phase1.c +@@ -170,9 +170,9 @@ _("Unable to find realtime device path.")); + + /* Open the raw devices. */ + ctx->datadev = disk_open(ctx->fsinfo.fs_name); +- if (error) { +- str_errno(ctx, ctx->fsinfo.fs_name); +- return error; ++ if (!ctx->datadev) { ++ str_error(ctx, ctx->mntpoint, _("Unable to open data device.")); ++ return ECANCELED; + } + + ctx->nr_io_threads = disk_heads(ctx->datadev); +@@ -184,16 +184,18 @@ _("Unable to find realtime device path.")); + + if (ctx->fsinfo.fs_log) { + ctx->logdev = disk_open(ctx->fsinfo.fs_log); +- if (error) { +- str_errno(ctx, ctx->fsinfo.fs_name); +- return error; ++ if (!ctx->logdev) { ++ str_error(ctx, ctx->mntpoint, ++ _("Unable to open external log device.")); ++ return ECANCELED; + } + } + if (ctx->fsinfo.fs_rt) { + ctx->rtdev = disk_open(ctx->fsinfo.fs_rt); +- if (error) { +- str_errno(ctx, ctx->fsinfo.fs_name); +- return error; ++ if (!ctx->rtdev) { ++ str_error(ctx, ctx->mntpoint, ++ _("Unable to open realtime device.")); ++ return ECANCELED; + } + } + +-- +2.33.0 diff --git a/xfsprogs.spec b/xfsprogs.spec index c23eba0..9e9a46e 100644 --- a/xfsprogs.spec +++ b/xfsprogs.spec @@ -1,6 +1,6 @@ Name: xfsprogs Version: 5.14.1 -Release: 16 +Release: 17 Summary: Administration and debugging tools for the XFS file system License: GPL+ and LGPLv2+ URL: https://xfs.wiki.kernel.org @@ -66,6 +66,7 @@ Patch44: 0044-fsck.xfs-mount-umount-xfs-fs-to-replay-log-before-ru.patch Patch45: 0045-xfs_db-fix-dir3-block-magic-check.patch Patch46: 0046-xfs_repair-fix-incorrect-dabtree-hashval-comparison.patch Patch47: 0047-xfs_scrub-handle-spurious-wakeups-in-scan_fs_tree.patch +Patch48: 0048-xfs_scrub-fix-reporting-if-we-can-t-open-raw-block-d.patch %description @@ -150,6 +151,9 @@ rm -rf %{buildroot}%{_datadir}/doc/xfsprogs/ %changelog +* Mon Nov 3 2025 xuchenchen - 5.14.1-17 +- xfs_scrub: fix reporting if we can't open raw block devices + * Tue Mar 19 2024 liuh - 5.14.1-16 - xfs_scrub: handle spurious wakeups in scan_fs_tree -- Gitee