xfs_scrub: fix reporting if we can't open raw block devices

This commit is contained in:
liuh 2024-07-24 09:31:11 +08:00
parent 529c6e3575
commit fc50a25b0b
2 changed files with 65 additions and 1 deletions

View File

@ -0,0 +1,60 @@
From d6febe33bf060d37c37f689c5b7a6c58af6afc97 Mon Sep 17 00:00:00 2001
From: "Darrick J. Wong" <djwong@kernel.org>
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 <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---
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

View File

@ -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
@ -76,6 +76,7 @@ Patch54: 0054-mkfs-Add-atomic-writes-suppport.patch
Patch55: 0055-xfs_io-Support-statx-for-atomic-writes.patch
Patch56: 0056-mkfs-Ensure-extsize-aligned-to-stripe-unit-for-force.patch
Patch57: 0057-xfs_io-Implement-lsattr-and-chattr-support-for-atomi.patch
Patch58: 0058-xfs_scrub-fix-reporting-if-we-can-t-open-raw-block-d.patch
%description
xfsprogs are the userspace utilities that manage XFS filesystems.
@ -160,6 +161,9 @@ rm -rf %{buildroot}%{_datadir}/doc/xfsprogs/
%changelog
* Wed Jul 24 2024 liuh <liuhuan01@kylinos.cn> - 5.14.1-17
- xfs_scrub: fix reporting if we can't open raw block devices
* Mon May 20 2024 zhangjian <zhangjian496@huawei.com> - 5.14.1-16
- support atomic write