xfsdump/xfsrestore: suggest recovery option -x

Suggest recovery for false roots may be possible using -x option.

Resolves: RHEL-11883
Signed-off-by: Pavel Reichl <preichl@redhat.com>
This commit is contained in:
Pavel Reichl 2023-10-05 21:53:18 +02:00
parent e817b843be
commit 892c094d4b
2 changed files with 64 additions and 1 deletions

View File

@ -0,0 +1,57 @@
From 8e97f9c2b3c362fa6dd872d72594713c713479bc Mon Sep 17 00:00:00 2001
From: Donald Douwsma <ddouwsma@redhat.com>
Date: Thu, 24 Aug 2023 12:07:04 +1000
Subject: [PATCH] xfsrestore: suggest -x rather than assert for false roots
If we're going to have a fix for false root problems its a good idea to
let people know that there's a way to recover, error out with a useful
message that mentions the `-x` option rather than just assert.
Before
xfsrestore: searching media for directory dump
xfsrestore: reading directories
xfsrestore: tree.c:757: tree_begindir: Assertion `ino != persp->p_rootino || hardh == persp->p_rooth' failed.
Aborted
After
xfsrestore: ERROR: tree.c:791: tree_begindir: Assertion `ino != persp->p_rootino || hardh == persp->p_rooth` failed.
xfsrestore: ERROR: False root detected. Recovery may be possible using the `-x` option
Aborted
Fixes: d7cba7410710 ("xfsrestore: fix rootdir due to xfsdump bulkstat misuse")
Signed-off-by: Donald Douwsma <ddouwsma@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Signed-off-by: Pavel Reichl <preichl@redhat.com>
---
restore/tree.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/restore/tree.c b/restore/tree.c
index bfa07fe..6f3180f 100644
--- a/restore/tree.c
+++ b/restore/tree.c
@@ -783,8 +783,15 @@ tree_begindir( filehdr_t *fhdrp, dah_t *dahp )
/* lookup head of hardlink list
*/
hardh = link_hardh( ino, gen );
- if (need_fixrootdir == BOOL_FALSE)
- assert( ino != persp->p_rootino || hardh == persp->p_rooth );
+ if (need_fixrootdir == BOOL_FALSE &&
+ !(ino != persp->p_rootino || hardh == persp->p_rooth)) {
+ mlog(MLOG_ERROR | MLOG_TREE,
+"%s:%d: %s: Assertion `ino != persp->p_rootino || hardh == persp->p_rooth` failed.\n",
+ __FILE__, __LINE__, __func__);
+ mlog(MLOG_ERROR | MLOG_TREE, _(
+"False root detected. Recovery may be possible using the `-x` option\n"));
+ return NH_NULL;
+ }
/* already present
*/
--
2.41.0

View File

@ -1,7 +1,7 @@
Summary: Administrative utilities for the XFS filesystem
Name: xfsdump
Version: 3.1.8
Release: 6%{?dist}
Release: 7%{?dist}
# Licensing based on generic "GNU GENERAL PUBLIC LICENSE"
# in source, with no mention of version.
License: GPL+
@ -16,6 +16,7 @@ Patch4: 0005-v3.1.12-xfsrestore-fix-on-media-inventory-media-unpacking.patch
Patch5: 0006-v3.1.12-xfsrestore-fix-on-media-inventory-stream-unpacking.patch
Patch6: 0007-v3.1.12-xfsdump-fix-on-media-inventory-stream-packing.patch
Patch7: 0008-v3.1.12-xfsrestore-untangle-inventory-unpacking-logic.patch
Patch8: 0009-v3.1.13-xfsrestore-suggest-x-rather-than-assert-for-false-ro.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: libtool, gettext, gawk
BuildRequires: xfsprogs-devel, libuuid-devel, libattr-devel ncurses-devel
@ -48,6 +49,7 @@ subtrees may be restored from full or partial backups.
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%build
%configure
@ -81,6 +83,10 @@ rm -rf $RPM_BUILD_ROOT
%{_sharedstatedir}/xfsdump/inventory
%changelog
* Thu Oct 05 2023 Pavel Reichl <preichl@redhat.com> - 3.1.8-7
- xfsdump/xfsrestore: suggest recovery for false roots may be possible using -x
- Related: RHEL-11883
* Tue Jun 20 2023 Pavel Reichl <preichl@redhat.com> - 3.1.8-6
- xfsdump: restoring inventory prevents non-directory files being restored from tape
- related: bz#2166554