xfsrestore: only process subtrees that are selected

Resolves: RHEL-31075
Signed-off-by: Donald Douwsma <ddouwsma@redhat.com>
This commit is contained in:
Donald Douwsma 2026-05-19 17:33:40 +10:00
parent cfd5d180b9
commit e30fdf7551
2 changed files with 73 additions and 2 deletions

View File

@ -0,0 +1,65 @@
From dd63de5d42e1073c09314fb1afc82c55e91c2853 Mon Sep 17 00:00:00 2001
From: Donald Douwsma <ddouwsma@redhat.com>
Date: Thu, 26 Mar 2026 13:54:43 +1100
Subject: [PATCH] xfsrestore: only process subtrees that are selected
We are getting reports from the field where xfsrestore is aborting due
to the failed assertion:
# xfsrestore -r -f /tmp/l0.dump -s somedir /mnt/scratch
...
# xfsrestore -r -f /tmp/l2.dump /mnt/scratch
...
xfsrestore: 8 directories and 7 entries processed
xfsrestore: directory post-processing
xfsrestore: tree.c:1369: noref_elim_recurse: Assertion `isrealpr' failed.
This occurs for cumulative restores where the initial restore has used
the subtree option to limit the trees being restored. If a subsequent
restore encounters a rename for a node outside of the selected trees it
aborts when It cannot find the directory to rename.
Make sure we skip processing for directories outside the selected trees
when eliminating unreferenced nodes in tree post processing.
Signed-off-by: Donald Douwsma <ddouwsma@redhat.com>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
---
restore/tree.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/restore/tree.c b/restore/tree.c
index 4707fdc..69301d9 100644
--- a/restore/tree.c
+++ b/restore/tree.c
@@ -1322,6 +1322,7 @@ noref_elim_recurse(nh_t parh,
gen_t gen;
bool_t inorphanagepr;
bool_t isdirpr;
+ bool_t isselpr;
bool_t isrealpr;
bool_t isrefpr;
bool_t isrenamepr;
@@ -1338,6 +1339,7 @@ noref_elim_recurse(nh_t parh,
isdirpr = (cldp->n_flags & NF_ISDIR);
isrealpr = (cldp->n_flags & NF_REAL);
isrefpr = (cldp->n_flags & NF_REFED);
+ isselpr = (cldp->n_flags & NF_SUBTREE);
isrenamepr = (isdirpr && cldp->n_lnkh != NH_NULL);
renameh = cldp->n_lnkh;
grandcldh = cldp->n_cldh;
@@ -1353,6 +1355,11 @@ noref_elim_recurse(nh_t parh,
Node_unmap(cldh, &cldp);
+ if (!isselpr) {
+ cldh = nextcldh;
+ continue;
+ }
+
if (isdirpr) {
bool_t ok;
--
2.47.3

View File

@ -1,7 +1,7 @@
Summary: Backup and restore utilities for the XFS filesystem
Name: xfsdump
Version: 3.2.0
Release: 1%{?dist}
Release: 2%{?dist}
# Licensing based on generic "GNU GENERAL PUBLIC LICENSE"
# in source, with no mention of version.
License: GPL-1.0-or-later
@ -15,6 +15,8 @@ BuildRequires: xfsprogs-devel, libuuid-devel, libattr-devel ncurses-devel
BuildRequires: gnupg2, xz
Requires: xfsprogs >= 2.6.30, attr >= 2.0.0
Patch0: xfsdump-3.3.0-xfsrestore-only-process-subtrees-that-are-selected.patch
%description
The xfsdump package contains xfsdump, xfsrestore and a number of
other utilities for administering XFS filesystems.
@ -34,7 +36,7 @@ subtrees may be restored from full or partial backups.
%prep
xzcat '%{SOURCE0}' | %{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data=-
%setup -q
%autosetup -p1
%build
%configure
@ -63,6 +65,10 @@ mkdir -p $RPM_BUILD_ROOT/%{_sharedstatedir}/xfsdump/inventory
%{_sharedstatedir}/xfsdump/inventory
%changelog
* Thu Mar 26 2026 Donald Douwsma <ddouwsma@redhat.com> - 3.2.0-2
- xfsrestore: only process subtrees that are selected
- Related: RHEL-31075
* Wed Nov 27 2024 Pavel Reichl <preichl@redhat.com> - 3.2.0-1
- Update to new upstream version 3.2.0
- Related: RHEL-69388