From 534a8e8fac0eee16a04dcc133957b24eaa6c043e Mon Sep 17 00:00:00 2001 From: Pavel Reichl Date: Fri, 6 Oct 2023 10:46:54 +0200 Subject: [PATCH] xfsdump/xfsrestore: suggest recovery option -x --- .xfsdump.metadata | 2 + ...st-x-rather-than-assert-for-false-ro.patch | 57 +++++++++++++++++++ xfsdump.spec | 7 ++- 3 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 .xfsdump.metadata create mode 100644 0002-v3.1.13-xfsrestore-suggest-x-rather-than-assert-for-false-ro.patch diff --git a/.xfsdump.metadata b/.xfsdump.metadata new file mode 100644 index 0000000..4720fad --- /dev/null +++ b/.xfsdump.metadata @@ -0,0 +1,2 @@ +521eb54097cd7df928659e51e376633cf222a2b7 xfsdump-3.1.12.tar.sign +20753a3244bd9470bc39fc8477ba9a33f2bdac75 xfsdump-3.1.12.tar.xz diff --git a/0002-v3.1.13-xfsrestore-suggest-x-rather-than-assert-for-false-ro.patch b/0002-v3.1.13-xfsrestore-suggest-x-rather-than-assert-for-false-ro.patch new file mode 100644 index 0000000..6551b08 --- /dev/null +++ b/0002-v3.1.13-xfsrestore-suggest-x-rather-than-assert-for-false-ro.patch @@ -0,0 +1,57 @@ +From 8e97f9c2b3c362fa6dd872d72594713c713479bc Mon Sep 17 00:00:00 2001 +From: Donald Douwsma +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 +Reviewed-by: Darrick J. Wong +Reviewed-by: Carlos Maiolino +Signed-off-by: Carlos Maiolino +Signed-off-by: Pavel Reichl +--- + 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 + diff --git a/xfsdump.spec b/xfsdump.spec index a1db222..a81ce77 100644 --- a/xfsdump.spec +++ b/xfsdump.spec @@ -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 - 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 - 3.1.12-3 - xfsdump: restoring inventory prevents non-directory files being restored from tape, - actually fixed by rebase to 3.1.12