From: "Darrick J. Wong" <djwong@kernel.org>
To: Zorro Lang <zlang@redhat.com>
Cc: Christoph Hellwig <hch@infradead.org>,
fstests@vger.kernel.org, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 15/14] xfs: test xfs_healer can follow private mntns mount moves
Date: Fri, 13 Mar 2026 16:41:06 -0700 [thread overview]
Message-ID: <20260313234106.GF6023@frogsfrogsfrogs> (raw)
In-Reply-To: <20260313200553.xujzlttj66eg7mgm@dell-per750-06-vm-08.rhts.eng.pek2.redhat.com>
On Sat, Mar 14, 2026 at 04:05:53AM +0800, Zorro Lang wrote:
> On Thu, Mar 12, 2026 at 07:21:30AM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> >
> > Make sure that when xfs_healer needs to reopen a filesystem to repair
> > it, it can still find the filesystem even if it has been mount --move'd.
> > This requires a bunch of private namespace magic.
> >
> > Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
> > ---
> > tests/xfs/1904 | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> > tests/xfs/1904.out | 3 +
> > 2 files changed, 132 insertions(+)
> > create mode 100755 tests/xfs/1904
> > create mode 100755 tests/xfs/1904.out
> >
> > diff --git a/tests/xfs/1904 b/tests/xfs/1904
> > new file mode 100755
> > index 00000000000000..78e8f5dcb0e834
> > --- /dev/null
> > +++ b/tests/xfs/1904
> > @@ -0,0 +1,129 @@
> > +#! /bin/bash
> > +# SPDX-License-Identifier: GPL-2.0
> > +# Copyright (c) 2026 Oracle. All Rights Reserved.
> > +#
> > +# FS QA Test 1904
> > +#
> > +# Ensure that autonomous self healing fixes the filesystem correctly even if
> > +# the original mount has moved somewhere else via --move.
> > +#
> > +. ./common/preamble
> > +_begin_fstest auto selfhealing
> > +
> > +. ./common/filter
> > +. ./common/fuzzy
> > +. ./common/systemd
> > +
> > +if [ -n "$IN_MOUNTNS" ]; then
> > + _mount --make-rprivate /
>
> I'd like to add this case and other cases related with mount propagation in this
> patchset to "mount" group. I'll do it when I merge this patchset. Others look and
> test good to me,
<nod> That sounds reasonable. Thanks for all the other minor touch-ups
that you applied before merging into patches-in-queue!
--D
>
> Reviewed-by: Zorro Lang <zlang@redhat.com>
>
> > + findmnt -o TARGET,PROPAGATION >> $seqres.full
> > +
> > + _scratch_mount
> > + _scratch_invoke_xfs_healer "$tmp.healer" --repair
> > +
> > + # Move the scratch filesystem to a completely different mountpoint so that
> > + # we can test if the healer can find it again.
> > + new_dir=$TEST_DIR/moocow
> > + mkdir -p $new_dir
> > + _mount --move $SCRATCH_MNT $new_dir
> > +
> > + df -t xfs >> $seqres.full
> > +
> > + # Access the broken directory to trigger a repair, then poll the directory
> > + # for 5 seconds to see if it gets fixed without us needing to intervene.
> > + ls $new_dir/some/victimdir > /dev/null 2> $tmp.err
> > + _filter_scratch < $tmp.err | _filter_test_dir
> > + try=0
> > + while [ $try -lt 50 ] && grep -q 'Structure needs cleaning' $tmp.err; do
> > + echo "try $try saw corruption" >> $seqres.full
> > + sleep 0.1
> > + ls $new_dir/some/victimdir > /dev/null 2> $tmp.err
> > + try=$((try + 1))
> > + done
> > + echo "try $try no longer saw corruption or gave up" >> $seqres.full
> > + _filter_scratch < $tmp.err | _filter_test_dir
> > +
> > + # List the dirents of /victimdir to see if it stops reporting corruption
> > + ls $new_dir/some/victimdir > /dev/null 2> $tmp.err
> > + try=0
> > + while [ $try -lt 50 ] && grep -q 'Structure needs cleaning' $tmp.err; do
> > + echo "retry $try still saw corruption" >> $seqres.full
> > + sleep 0.1
> > + ls $SCRATCH_MNT/some/victimdir > /dev/null 2> $tmp.err
> > + try=$((try + 1))
> > + done
> > + echo "retry $try no longer saw corruption or gave up" >> $seqres.full
> > +
> > + new_dir_unmount() {
> > + _unmount $new_dir
> > + }
> > +
> > + # Unmount to kill the healer
> > + _scratch_kill_xfs_healer new_dir_unmount
> > + cat $tmp.healer >> $seqres.full
> > +
> > + # No need to clean up, the mount ns destructor will detach the
> > + # filesystems for us.
> > + exit
> > +fi
> > +
> > +_cleanup()
> > +{
> > + command -v _kill_fsstress &>/dev/null && _kill_fsstress
> > + cd /
> > + rm -r -f $tmp.*
> > + if [ -n "$new_dir" ]; then
> > + _unmount "$new_dir" &>/dev/null
> > + rm -rf "$new_dir"
> > + fi
> > +}
> > +
> > +_require_unshare
> > +_require_test
> > +_require_scrub
> > +_require_xfs_io_command "repair" # online repair support
> > +_require_xfs_db_command "blocktrash"
> > +_require_command "$XFS_HEALER_PROG" "xfs_healer"
> > +_require_command "$XFS_PROPERTY_PROG" "xfs_property"
> > +_require_scratch
> > +
> > +_scratch_mkfs >> $seqres.full
> > +_scratch_mount
> > +
> > +_xfs_has_feature $SCRATCH_MNT rmapbt || \
> > + _notrun "reverse mapping required to test directory auto-repair"
> > +_xfs_has_feature $SCRATCH_MNT parent || \
> > + _notrun "parent pointers required to test directory auto-repair"
> > +_require_xfs_healer $SCRATCH_MNT --repair
> > +
> > +# Configure the filesystem for automatic repair of the filesystem.
> > +$XFS_PROPERTY_PROG $SCRATCH_MNT set autofsck=repair >> $seqres.full
> > +
> > +# Create a largeish directory
> > +dblksz=$(_xfs_get_dir_blocksize "$SCRATCH_MNT")
> > +echo testdata > $SCRATCH_MNT/a
> > +mkdir -p "$SCRATCH_MNT/some/victimdir"
> > +for ((i = 0; i < (dblksz / 255); i++)); do
> > + fname="$(printf "%0255d" "$i")"
> > + ln $SCRATCH_MNT/a $SCRATCH_MNT/some/victimdir/$fname
> > +done
> > +
> > +# Did we get at least two dir blocks?
> > +dirsize=$(stat -c '%s' $SCRATCH_MNT/some/victimdir)
> > +test "$dirsize" -gt "$dblksz" || echo "failed to create two-block directory"
> > +
> > +# Break the directory, remount filesystem
> > +_scratch_unmount
> > +_scratch_xfs_db -x \
> > + -c 'path /some/victimdir' \
> > + -c 'bmap' \
> > + -c 'dblock 1' \
> > + -c 'blocktrash -z -0 -o 0 -x 2048 -y 2048 -n 2048' >> $seqres.full
> > +
> > +# mount --move only works if mount propagation is disabled, so we have to start
> > +# a subshell with a separate mount namespace, disable propagation for the
> > +# entire directory tree, and only then can we run our tests.
> > +IN_MOUNTNS=1 unshare -m bash "$0"
> > +
> > +status=0
> > +exit
> > diff --git a/tests/xfs/1904.out b/tests/xfs/1904.out
> > new file mode 100755
> > index 00000000000000..34a46298dd439a
> > --- /dev/null
> > +++ b/tests/xfs/1904.out
> > @@ -0,0 +1,3 @@
> > +QA output created by 1904
> > +QA output created by 1904
> > +ls: reading directory 'TEST_DIR/moocow/some/victimdir': Structure needs cleaning
> >
>
>
prev parent reply other threads:[~2026-03-13 23:41 UTC|newest]
Thread overview: 93+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-10 3:38 [PATCHBOMB v9] xfsprogs: autonomous self healing of filesystems Darrick J. Wong
2026-03-10 3:42 ` [PATCHSET " Darrick J. Wong
2026-03-10 3:42 ` [PATCH 01/28] libfrog: add a function to grab the path from an open fd and a file handle Darrick J. Wong
2026-03-10 3:43 ` [PATCH 02/28] libfrog: create healthmon event log library functions Darrick J. Wong
2026-03-10 3:43 ` [PATCH 03/28] libfrog: add support code for starting systemd services programmatically Darrick J. Wong
2026-03-10 9:24 ` Christoph Hellwig
2026-03-10 18:35 ` Darrick J. Wong
2026-03-10 3:43 ` [PATCH 04/28] libfrog: hoist a couple of service helper functions Darrick J. Wong
2026-03-10 3:43 ` [PATCH 05/28] libfrog: add wrappers for listmount and statmount Darrick J. Wong
2026-03-10 9:24 ` Christoph Hellwig
2026-03-10 3:44 ` [PATCH 06/28] man2: document the healthmon ioctl Darrick J. Wong
2026-03-10 3:44 ` [PATCH 07/28] man2: document the media verification ioctl Darrick J. Wong
2026-03-10 3:44 ` [PATCH 08/28] xfs_io: monitor filesystem health events Darrick J. Wong
2026-03-10 3:44 ` [PATCH 09/28] xfs_io: add a media verify command Darrick J. Wong
2026-03-10 3:45 ` [PATCH 10/28] xfs_healer: create daemon to listen for health events Darrick J. Wong
2026-03-10 3:45 ` [PATCH 11/28] xfs_healer: enable repairing filesystems Darrick J. Wong
2026-03-10 3:45 ` [PATCH 12/28] xfs_healer: use getparents to look up file names Darrick J. Wong
2026-03-10 3:45 ` [PATCH 13/28] xfs_healer: create a per-mount background monitoring service Darrick J. Wong
2026-03-10 9:25 ` Christoph Hellwig
2026-03-10 3:46 ` [PATCH 14/28] xfs_healer: create a service to start the per-mount healer service Darrick J. Wong
2026-03-10 9:25 ` Christoph Hellwig
2026-03-10 3:46 ` [PATCH 15/28] xfs_healer: don't start service if kernel support unavailable Darrick J. Wong
2026-03-10 3:46 ` [PATCH 16/28] xfs_healer: use the autofsck fsproperty to select mode Darrick J. Wong
2026-03-10 3:46 ` [PATCH 17/28] xfs_healer: run full scrub after lost corruption events or targeted repair failure Darrick J. Wong
2026-03-10 3:47 ` [PATCH 18/28] xfs_healer: use getmntent to find moved filesystems Darrick J. Wong
2026-03-10 3:47 ` [PATCH 19/28] xfs_healer: use statmount to find moved filesystems even faster Darrick J. Wong
2026-03-10 9:28 ` Christoph Hellwig
2026-03-10 18:56 ` Darrick J. Wong
2026-03-10 20:06 ` Darrick J. Wong
2026-03-12 7:06 ` Christoph Hellwig
2026-03-12 14:19 ` Darrick J. Wong
2026-03-10 3:47 ` [PATCH 20/28] xfs_healer: validate that repair fds point to the monitored fs Darrick J. Wong
2026-03-10 9:28 ` Christoph Hellwig
2026-03-10 3:48 ` [PATCH 21/28] xfs_healer: add a manual page Darrick J. Wong
2026-03-10 3:48 ` [PATCH 22/28] xfs_scrub: use the verify media ioctl during phase 6 if possible Darrick J. Wong
2026-03-10 9:29 ` Christoph Hellwig
2026-03-10 3:48 ` [PATCH 23/28] xfs_scrub: perform media scanning of the log region Darrick J. Wong
2026-03-10 3:48 ` [PATCH 24/28] xfs_scrub: print systemd service names Darrick J. Wong
2026-03-10 9:29 ` Christoph Hellwig
2026-03-10 3:49 ` [PATCH 25/28] xfs_io: add listmount and statmount commands Darrick J. Wong
2026-03-10 9:29 ` Christoph Hellwig
2026-03-10 3:49 ` [PATCH 26/28] mkfs: enable online repair if all backrefs are enabled Darrick J. Wong
2026-03-10 9:30 ` Christoph Hellwig
2026-03-16 16:21 ` Christoph Hellwig
2026-03-16 16:32 ` Darrick J. Wong
2026-03-10 3:49 ` [PATCH 27/28] debian/control: listify the build dependencies Darrick J. Wong
2026-03-10 9:30 ` Christoph Hellwig
2026-03-10 3:49 ` [PATCH 28/28] debian: enable xfs_healer on the root filesystem by default Darrick J. Wong
2026-03-10 9:31 ` Christoph Hellwig
2026-03-10 3:42 ` [PATCHSET v9 1/2] fstests: test generic file IO error reporting Darrick J. Wong
2026-03-10 3:50 ` [PATCH 1/1] generic: test fsnotify filesystem " Darrick J. Wong
2026-03-10 7:07 ` Amir Goldstein
2026-03-13 18:01 ` Zorro Lang
2026-03-13 23:27 ` Darrick J. Wong
2026-03-16 9:08 ` Christoph Hellwig
2026-03-16 16:21 ` Darrick J. Wong
2026-03-16 18:40 ` Zorro Lang
2026-03-16 22:16 ` Darrick J. Wong
2026-03-17 3:43 ` Zorro Lang
2026-03-10 3:42 ` [PATCHSET v9 2/2] fstests: autonomous self healing of filesystems Darrick J. Wong
2026-03-10 3:50 ` [PATCH 01/14] xfs: test health monitoring code Darrick J. Wong
2026-03-13 18:18 ` Zorro Lang
2026-03-10 3:50 ` [PATCH 02/14] xfs: test for metadata corruption error reporting via healthmon Darrick J. Wong
2026-03-13 18:35 ` Zorro Lang
2026-03-10 3:50 ` [PATCH 03/14] xfs: test io " Darrick J. Wong
2026-03-13 18:53 ` Zorro Lang
2026-03-10 3:51 ` [PATCH 04/14] xfs: set up common code for testing xfs_healer Darrick J. Wong
2026-03-13 19:04 ` Zorro Lang
2026-03-14 20:37 ` Zorro Lang
2026-03-15 4:51 ` Darrick J. Wong
2026-03-10 3:51 ` [PATCH 05/14] xfs: test xfs_healer's event handling Darrick J. Wong
2026-03-13 19:19 ` Zorro Lang
2026-03-10 3:51 ` [PATCH 06/14] xfs: test xfs_healer can fix a filesystem Darrick J. Wong
2026-03-13 19:28 ` Zorro Lang
2026-03-10 3:51 ` [PATCH 07/14] xfs: test xfs_healer can report file I/O errors Darrick J. Wong
2026-03-13 19:32 ` Zorro Lang
2026-03-10 3:52 ` [PATCH 08/14] xfs: test xfs_healer can report file media errors Darrick J. Wong
2026-03-13 19:36 ` Zorro Lang
2026-03-10 3:52 ` [PATCH 09/14] xfs: test xfs_healer can report filesystem shutdowns Darrick J. Wong
2026-03-13 19:45 ` Zorro Lang
2026-03-10 3:52 ` [PATCH 10/14] xfs: test xfs_healer can initiate full filesystem repairs Darrick J. Wong
2026-03-13 19:48 ` Zorro Lang
2026-03-10 3:52 ` [PATCH 11/14] xfs: test xfs_healer can follow mount moves Darrick J. Wong
2026-03-13 19:39 ` Zorro Lang
2026-03-10 3:53 ` [PATCH 12/14] xfs: test xfs_healer wont repair the wrong filesystem Darrick J. Wong
2026-03-13 19:53 ` Zorro Lang
2026-03-10 3:53 ` [PATCH 13/14] xfs: test xfs_healer background service Darrick J. Wong
2026-03-13 19:56 ` Zorro Lang
2026-03-10 3:53 ` [PATCH 14/14] xfs: test xfs_healer startup service Darrick J. Wong
2026-03-13 19:58 ` Zorro Lang
2026-03-12 14:21 ` [PATCH 15/14] xfs: test xfs_healer can follow private mntns mount moves Darrick J. Wong
2026-03-13 20:05 ` Zorro Lang
2026-03-13 23:41 ` Darrick J. Wong [this message]
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=20260313234106.GF6023@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=hch@infradead.org \
--cc=linux-xfs@vger.kernel.org \
--cc=zlang@redhat.com \
/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