xfsdump/xfsrestore: suggest recovery option -x

This commit is contained in:
Pavel Reichl 2023-10-06 10:46:54 +02:00 committed by Stepan Oksanichenko
parent 72d78d47c5
commit 534a8e8fac
3 changed files with 65 additions and 1 deletions

2
.xfsdump.metadata Normal file
View File

@ -0,0 +1,2 @@
521eb54097cd7df928659e51e376633cf222a2b7 xfsdump-3.1.12.tar.sign
20753a3244bd9470bc39fc8477ba9a33f2bdac75 xfsdump-3.1.12.tar.xz

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: Backup and restore utilities for the XFS filesystem
Name: xfsdump
Version: 3.1.12
Release: 3%{?dist}
Release: 4%{?dist}
# Licensing based on generic "GNU GENERAL PUBLIC LICENSE"
# in source, with no mention of version.
License: GPL+
@ -16,6 +16,7 @@ BuildRequires: gnupg2, xz
Requires: xfsprogs >= 2.6.30, attr >= 2.0.0
Patch0: 0001-for-next-xfsrestore-fix-rootdir-due-to-xfsdump-bulkstat-misus.patch
Patch1: 0002-v3.1.13-xfsrestore-suggest-x-rather-than-assert-for-false-ro.patch
%description
The xfsdump package contains xfsdump, xfsrestore and a number of
@ -65,6 +66,10 @@ mkdir -p $RPM_BUILD_ROOT/%{_sharedstatedir}/xfsdump/inventory
%{_sharedstatedir}/xfsdump/inventory
%changelog
* Fri Oct 06 2023 Pavel Reichl <preichl@redhat.com> - 3.1.12-4
- xfsdump/xfsrestore: suggest recovery for false roots may be possible using -x
- Related: RHEL-8000
* Mon Jun 26 2023 Pavel Reichl <preichl@redhat.com> - 3.1.12-3
- xfsdump: restoring inventory prevents non-directory files being restored from tape,
- actually fixed by rebase to 3.1.12