public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Donald Douwsma <ddouwsma@redhat.com>
To: linux-xfs@vger.kernel.org
Cc: Donald Douwsma <ddouwsma@redhat.com>
Subject: [PATCH] xfsrestore: only process subtrees that are selected
Date: Thu, 26 Mar 2026 13:54:43 +1100	[thread overview]
Message-ID: <20260326025443.1569874-1-ddouwsma@redhat.com> (raw)

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>
---
 restore/tree.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/restore/tree.c b/restore/tree.c
index 4e7cf7b..91c5e9d 100644
--- a/restore/tree.c
+++ b/restore/tree.c
@@ -1321,6 +1321,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;
@@ -1337,6 +1338,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;
@@ -1352,6 +1354,11 @@ noref_elim_recurse(nh_t parh,
 
 		Node_unmap(cldh, &cldp);
 
+		if (!isselpr) {
+			cldh = nextcldh;
+			continue;
+		}
+
 		if (isdirpr) {
 			bool_t ok;
 
-- 
2.47.3


             reply	other threads:[~2026-03-26  2:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-26  2:54 Donald Douwsma [this message]
2026-03-26  3:00 ` [PATCH] xfs: test xfsdump subtree restores Donald Douwsma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260326025443.1569874-1-ddouwsma@redhat.com \
    --to=ddouwsma@redhat.com \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox