From: Zorro Lang <zlang@redhat.com>
To: Murphy Zhou <xzhou@redhat.com>
Cc: "Darrick J. Wong" <djwong@kernel.org>,
fstests@vger.kernel.org, ddouwsma@redhat.com,
Eryu Guan <eguan@linux.alibaba.com>
Subject: Re: [PATCH v4] tests/generic: check log recovery with readonly mount
Date: Tue, 24 Aug 2021 20:57:17 +0800 [thread overview]
Message-ID: <20210824125717.revcpz7bvirta3mo@fedora> (raw)
In-Reply-To: <20210824090638.cfg7irh6bo55ey26@xzhoux.usersys.redhat.com>
On Tue, Aug 24, 2021 at 05:06:38PM +0800, Murphy Zhou wrote:
> And followed by a rw mount. After log recovery by these 2 mount, the
> filesystem should be in a consistent state.
>
> Suggested-by: Donald Douwsma <ddouwsma@redhat.com>
> Reviewed-by: Darrick J. Wong <djwong@kernel.org>
> Signed-off-by: Murphy Zhou <xzhou@redhat.com>
> ---
>
> Thanks Eryu and Zorro!
>
> v2:
> Add explanation of the issue
> add xfs_force_bdev data $SCRATCH_MNT
> use DF_PROG
> Re numbered this test
> v3:
> Add _require_scratch_shutdown
> Use _get_available_space
> Explain why does not use _scratch_mount
> v4:
> Add to recoveryloop group
> Move to generic as there are no xfs specific operations
> Remove all operations after 2 cycle mounts, let the fsck in fstests
> to check the filesystem consistency
> Use _scratch_shutdown, MOUNT_PROG
> Remove unnecessary comments
>
> tests/generic/999 | 45 +++++++++++++++++++++++++++++++++++++++++++
> tests/generic/999.out | 2 ++
> 2 files changed, 47 insertions(+)
> create mode 100755 tests/generic/999
> create mode 100644 tests/generic/999.out
>
> diff --git a/tests/generic/999 b/tests/generic/999
> new file mode 100755
> index 00000000..9685488b
> --- /dev/null
> +++ b/tests/generic/999
> @@ -0,0 +1,45 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2021 RedHat All Rights Reserved.
> +#
> +# FS QA Test 999
> +#
> +# Testcase for kernel commit:
> +# 50d25484bebe xfs: sync lazy sb accounting on quiesce of read-only mounts
> +#
> +# After shutdown and readonly mount, a following read-write mount would
> +# get wrong number of available blocks. This is caused by unmounting the log
> +# on a readonly filesystem doesn't log the sb counters.
> +#
> +. ./common/preamble
> +_begin_fstest auto quick recoveryloop shutdown
> +
> +# real QA test starts here
> +
> +_require_scratch
> +_require_scratch_shutdown
> +_scratch_mkfs > $seqres.full 2>&1
> +
> +# Don't use _scratch_mount because we need to mount without SELinux context
> +# to reproduce this issue. If we mount with _scratch_mount, SELinux context
> +# maybe applied and this testcase is not reproducing the original issue.
> +$MOUNT_PROG $SCRATCH_DEV $SCRATCH_MNT
This's weird, I think the SELinux mount option only can make below testfile
have no selinux label (xattr). But I don't think it's related with this bug.
So I tried to use "_scratch_mount", then still can reproduce this bug. May
you try it again?
# git diff
diff --git a/tests/generic/999 b/tests/generic/999
index 9685488b..a196e65d 100755
--- a/tests/generic/999
+++ b/tests/generic/999
@@ -23,8 +23,11 @@ _scratch_mkfs > $seqres.full 2>&1
# Don't use _scratch_mount because we need to mount without SELinux context
# to reproduce this issue. If we mount with _scratch_mount, SELinux context
# maybe applied and this testcase is not reproducing the original issue.
-$MOUNT_PROG $SCRATCH_DEV $SCRATCH_MNT
-_xfs_force_bdev data $SCRATCH_MNT
+#$MOUNT_PROG $SCRATCH_DEV $SCRATCH_MNT
+_scratch_mount
+if [ "$FSTYP" = "xfs" ];then
+ _xfs_force_bdev data $SCRATCH_MNT
+fi
# ./check generic/999
FSTYP -- xfs (non-debug)
PLATFORM -- Linux/x86_64 hp-dl380pg8-01 4.18.0-xxx.el8.x86_64+debug #1 SMP Tue Jun 15 10:43:04 EDT 2021
MKFS_OPTIONS -- -f /dev/mapper/rhel_hp--dl380pg8--01-xfscratch
MOUNT_OPTIONS -- -o context=system_u:object_r:root_t:s0 /dev/mapper/rhel_hp--dl380pg8--01-xfscratch /mnt/scratch
generic/999 16s ... _check_xfs_filesystem: filesystem on /dev/mapper/rhel_hp--dl380pg8--01-xfscratch is inconsistent (r)
(see /home/xfstests-dev/results//generic/999.full for details)
Ran: generic/999
Failures: generic/999
Failed 1 of 1 tests
> +_xfs_force_bdev data $SCRATCH_MNT
This's a xfs only helper, for a generic case, better to:
if [ "$FSTYP" = "xfs" ];then
_xfs_force_bdev data $SCRATCH_MNT
fi
> +
> +echo Testing > $SCRATCH_MNT/testfile
> +
> +# -f is required to reproduce
> +_scratch_shutdown -f
> +
> +_scratch_cycle_mount ro
> +_scratch_cycle_mount
> +
> +# These 2 mount should have the log fully recovered. Exit here and let the
> +# fsck operation to check the consistence of the tested filesystem. On the
> +# buggy kernel, this testcase reports filesystem is in inconsistent state.
> +# On the fixed kernel, testcase pass.
> +
> +# success, all done
> +echo "Silence is golden"
> +status=0
> +exit
> diff --git a/tests/generic/999.out b/tests/generic/999.out
> new file mode 100644
> index 00000000..3b276ca8
> --- /dev/null
> +++ b/tests/generic/999.out
> @@ -0,0 +1,2 @@
> +QA output created by 999
> +Silence is golden
> --
> 2.20.1
>
next prev parent reply other threads:[~2021-08-24 12:36 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-06 1:49 [PATCH] tests/xfs: check avail blocks after log recovery on ro mount Murphy Zhou
2021-08-06 18:55 ` Darrick J. Wong
2021-08-23 7:05 ` [PATCH v2] tests/xfs: check available " Murphy Zhou
2021-08-23 17:43 ` Darrick J. Wong
2021-08-24 5:04 ` [PATCH v3] " Murphy Zhou
2021-08-24 5:42 ` Eryu Guan
2021-08-24 6:23 ` Zorro Lang
2021-08-24 9:06 ` [PATCH v4] tests/generic: check log recovery with readonly mount Murphy Zhou
2021-08-24 12:57 ` Zorro Lang [this message]
2021-08-24 23:22 ` [PATCH v3] tests/xfs: check available blocks after log recovery on ro mount Donald Douwsma
2021-08-25 1:06 ` Donald Douwsma
2021-08-25 3:26 ` [PATCH v5] tests/generic: check log recovery with readonly mount Murphy Zhou
2021-08-26 0:17 ` Darrick J. Wong
2021-08-26 7:01 ` Zorro Lang
2021-08-24 15:14 ` [PATCH v3] tests/xfs: check available blocks after log recovery on ro mount Darrick J. Wong
2021-08-24 16:53 ` Zorro Lang
2021-08-25 23:43 ` Darrick J. Wong
2021-08-26 0:00 ` Murphy Zhou
2021-08-26 0:15 ` Darrick J. Wong
2021-08-26 6:59 ` 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=20210824125717.revcpz7bvirta3mo@fedora \
--to=zlang@redhat.com \
--cc=ddouwsma@redhat.com \
--cc=djwong@kernel.org \
--cc=eguan@linux.alibaba.com \
--cc=fstests@vger.kernel.org \
--cc=xzhou@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