xfsrestore: only process subtrees that are selected

Resolves: RHEL-179062
Signed-off-by: Donald Douwsma <ddouwsma@redhat.com>
This commit is contained in:
Donald Douwsma 2026-03-26 17:22:44 +11:00
parent 8aabb69fe5
commit dcc577bcb6
2 changed files with 82 additions and 1 deletions

View File

@ -0,0 +1,75 @@
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 | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/restore/tree.c b/restore/tree.c
index 0eb9fa3..44a46ea 100644
--- a/restore/tree.c
+++ b/restore/tree.c
@@ -1278,6 +1278,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;
@@ -1291,10 +1292,11 @@ noref_elim_recurse( nh_t parh,
ino = cldp->n_ino;
gen = cldp->n_gen;
inorphanagepr = cldp->n_parh == persp->p_orphh;
- isdirpr = ( cldp->n_flags & NF_ISDIR );
- isrealpr = ( cldp->n_flags & NF_REAL );
- isrefpr = ( cldp->n_flags & NF_REFED );
- isrenamepr = ( isdirpr && cldp->n_lnkh != NH_NULL );
+ 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;
nextcldh = cldp->n_sibh;
@@ -1309,7 +1311,12 @@ noref_elim_recurse( nh_t parh,
Node_unmap( cldh, &cldp );
- if ( isdirpr ) {
+ if (!isselpr) {
+ cldh = nextcldh;
+ continue;
+ }
+
+ if (isdirpr) {
bool_t ok;
ok = noref_elim_recurse( cldh,
--
2.47.3

View File

@ -1,7 +1,7 @@
Summary: Administrative utilities for the XFS filesystem
Name: xfsdump
Version: 3.1.8
Release: 7%{?dist}
Release: 8%{?dist}
# Licensing based on generic "GNU GENERAL PUBLIC LICENSE"
# in source, with no mention of version.
License: GPL+
@ -17,6 +17,7 @@ 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
Patch9: 0010-v3.3.0-xfsrestore-only-process-subtrees-that-are-selected.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: libtool, gettext, gawk
BuildRequires: xfsprogs-devel, libuuid-devel, libattr-devel ncurses-devel
@ -50,6 +51,7 @@ subtrees may be restored from full or partial backups.
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%build
%configure
@ -83,6 +85,10 @@ rm -rf $RPM_BUILD_ROOT
%{_sharedstatedir}/xfsdump/inventory
%changelog
* Tue Jun 2 2026 Donald Douwsma <ddouwsma@redhat.com> - 3.1.8-8
- xfsrestore: only process subtrees that are selected
- Related: RHEL-31075, RHEL-179062
* 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