Linux XFS filesystem development
 help / color / mirror / Atom feed
From: Donald Douwsma <ddouwsma@redhat.com>
To: linux-xfs@vger.kernel.org, fstests@vger.kernel.org
Cc: Donald Douwsma <ddouwsma@redhat.com>
Subject: [PATCH v2] xfs: test xfsdump subtree restores
Date: Thu, 23 Jul 2026 16:26:17 +1000	[thread overview]
Message-ID: <20260723062617.424905-1-ddouwsma@redhat.com> (raw)

Regression test for cumulative restores where a directory has been
renamed outside of the subtree being restored triggering the assert:

  xfsrestore: tree.c:1421: noref_elim_recurse: Assertion 'isrealpr' failed

Signed-off-by: Donald Douwsma <ddouwsma@redhat.com>
---
Changes since v1
- Fix use of _do, including label quoting
- Update test output
- Add tests for additional edge cases
---
 tests/xfs/995     | 58 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/995.out |  8 +++++++
 2 files changed, 66 insertions(+)
 create mode 100755 tests/xfs/995
 create mode 100644 tests/xfs/995.out

diff --git a/tests/xfs/995 b/tests/xfs/995
new file mode 100755
index 000000000..bba0bcd52
--- /dev/null
+++ b/tests/xfs/995
@@ -0,0 +1,58 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2026 Red Hat.  All Rights Reserved.
+#
+# FS QA Test 995
+#
+# Regression test for cumulative restores where a directory has been
+# renamed outside of the subtree being restored resulting in
+#
+#   xfsrestore: tree.c:1421: noref_elim_recurse: Assertion 'isrealpr' failed
+#
+. ./common/preamble
+_begin_fstest auto dump
+_do_die_on_error="always"
+
+_fixed_by_git_commit xfsdump dd63de5 \
+	"xfsrestore: only process subtrees that are selected"
+
+# Override the default cleanup function.
+_cleanup()
+{
+	_cleanup_dump
+	cd /
+	rm -r -f $tmp.*
+}
+
+# Import common functions.
+. ./common/dump
+
+# Modify as appropriate.
+_require_scratch
+_scratch_mkfs_xfs >>$seqres.full
+_scratch_mount
+
+mkdir -p $SCRATCH_MNT/a/b/c/d/e/f/g
+mkdir -p $SCRATCH_MNT/restore_me/B/C/D/E/F/G
+
+_do "Creating l0 dump" "$XFSDUMP_PROG -L lab_l0 -M test -l0 -f $tmp.dump.l0 $SCRATCH_MNT"
+
+mv $SCRATCH_MNT/a/b/c $SCRATCH_MNT/1
+
+_do "Creating l2 dump" "$XFSDUMP_PROG -L lab_l2.0 -M test -l2 -f $tmp.dump.l2.0 $SCRATCH_MNT"
+
+dir=$(mktemp -d $SCRATCH_MNT/restore_XXX)
+_do "Cumulative restore l0" "$XFSRESTORE_PROG -f $tmp.dump.l0 -r $dir"
+_do "Cumulative restore l2" "$XFSRESTORE_PROG -f $tmp.dump.l2.0 -r $dir"
+
+dir=$(mktemp -d $SCRATCH_MNT/restore_XXX)
+_do "Cumulative subtree restore l0" "$XFSRESTORE_PROG -f $tmp.dump.l0 -r -s restore_me $dir"
+# The next command core dumps prior to xfsdump v3.3.0 when noref_elim_recurse attempts to
+# rename directories outside of the subtree when their parent has not been created.
+_do "Cumulative subtree restore l2" "$XFSRESTORE_PROG -f $tmp.dump.l2.0 -r $dir"
+
+dir=$(mktemp -d $SCRATCH_MNT/restore_XXX)
+_do "Restore l2 on its own" "$XFSRESTORE_PROG -f $tmp.dump.l0 -r -s restore_me $dir"
+
+# success, all done
+_exit 0
diff --git a/tests/xfs/995.out b/tests/xfs/995.out
new file mode 100644
index 000000000..9a620eb31
--- /dev/null
+++ b/tests/xfs/995.out
@@ -0,0 +1,8 @@
+QA output created by 995
+Creating l0 dump... done
+Creating l2 dump... done
+Cumulative restore l0... done
+Cumulative restore l2... done
+Cumulative subtree restore l0... done
+Cumulative subtree restore l2... done
+Restore l2 on its own... done
-- 
2.52.0


             reply	other threads:[~2026-07-23  6:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-23  6:26 Donald Douwsma [this message]
2026-07-28  3:25 ` [PATCH v2] xfs: test xfsdump subtree restores Christoph Hellwig
2026-07-28 10:34   ` Zorro Lang
2026-07-28 10:29 ` Zorro Lang
2026-07-28 10:39 ` Zorro Lang

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=20260723062617.424905-1-ddouwsma@redhat.com \
    --to=ddouwsma@redhat.com \
    --cc=fstests@vger.kernel.org \
    --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