diff mbox series

[v5] tests/generic: check log recovery with readonly mount

Message ID 20210825032630.gezd2jvkd4oczzsx@xzhoux.usersys.redhat.com (mailing list archive)
State New, archived
Headers show
Series [v5] tests/generic: check log recovery with readonly mount | expand

Commit Message

Murphy Zhou Aug. 25, 2021, 3:26 a.m. UTC
And followed by a rw mount. After log recovery by these 2 mounts, 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 for reviewing! It seems my last several replies from gmail got
rejected by the list.

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 is 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
v5:
   Make _xfs_force_bdev xfs only
   Use _scratch_mount, it's still reproducible


 tests/generic/999     | 42 ++++++++++++++++++++++++++++++++++++++++++
 tests/generic/999.out |  2 ++
 2 files changed, 44 insertions(+)
 create mode 100755 tests/generic/999
 create mode 100644 tests/generic/999.out

Comments

Darrick J. Wong Aug. 26, 2021, 12:17 a.m. UTC | #1
On Wed, Aug 25, 2021 at 11:26:30AM +0800, Murphy Zhou wrote:
> And followed by a rw mount. After log recovery by these 2 mounts, 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 for reviewing! It seems my last several replies from gmail got
> rejected by the list.
> 
> 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 is 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
> v5:
>    Make _xfs_force_bdev xfs only
>    Use _scratch_mount, it's still reproducible

Ok, seems fine now.

--D

> 
> 
>  tests/generic/999     | 42 ++++++++++++++++++++++++++++++++++++++++++
>  tests/generic/999.out |  2 ++
>  2 files changed, 44 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..60e0ce59
> --- /dev/null
> +++ b/tests/generic/999
> @@ -0,0 +1,42 @@
> +#! /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
> +
> +_scratch_mount
> +[ "$FSTYP" == "xfs" ] && _xfs_force_bdev data $SCRATCH_MNT
> +
> +echo Testing > $SCRATCH_MNT/testfile
> +
> +# -f is required to reproduce the original issue
> +_scratch_shutdown -f
> +
> +_scratch_cycle_mount ro
> +_scratch_cycle_mount
> +
> +# These two mounts should have the log fully recovered. Exit here and let the
> +# fsck operation of xfstests to check the consistence of the tested filesystem.
> +# On the buggy kernel, this testcase reports filesystem is inconsistent.
> +# 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
>
Zorro Lang Aug. 26, 2021, 7:01 a.m. UTC | #2
On Wed, Aug 25, 2021 at 11:26:30AM +0800, Murphy Zhou wrote:
> And followed by a rw mount. After log recovery by these 2 mounts, 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 for reviewing! It seems my last several replies from gmail got
> rejected by the list.
> 
> 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 is 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
> v5:
>    Make _xfs_force_bdev xfs only
>    Use _scratch_mount, it's still reproducible

Good to me now,
Reviewed-by: Zorro Lang <zlang@redhat.com>

> 
> 
>  tests/generic/999     | 42 ++++++++++++++++++++++++++++++++++++++++++
>  tests/generic/999.out |  2 ++
>  2 files changed, 44 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..60e0ce59
> --- /dev/null
> +++ b/tests/generic/999
> @@ -0,0 +1,42 @@
> +#! /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
> +
> +_scratch_mount
> +[ "$FSTYP" == "xfs" ] && _xfs_force_bdev data $SCRATCH_MNT
> +
> +echo Testing > $SCRATCH_MNT/testfile
> +
> +# -f is required to reproduce the original issue
> +_scratch_shutdown -f
> +
> +_scratch_cycle_mount ro
> +_scratch_cycle_mount
> +
> +# These two mounts should have the log fully recovered. Exit here and let the
> +# fsck operation of xfstests to check the consistence of the tested filesystem.
> +# On the buggy kernel, this testcase reports filesystem is inconsistent.
> +# 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
>
diff mbox series

Patch

diff --git a/tests/generic/999 b/tests/generic/999
new file mode 100755
index 00000000..60e0ce59
--- /dev/null
+++ b/tests/generic/999
@@ -0,0 +1,42 @@ 
+#! /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
+
+_scratch_mount
+[ "$FSTYP" == "xfs" ] && _xfs_force_bdev data $SCRATCH_MNT
+
+echo Testing > $SCRATCH_MNT/testfile
+
+# -f is required to reproduce the original issue
+_scratch_shutdown -f
+
+_scratch_cycle_mount ro
+_scratch_cycle_mount
+
+# These two mounts should have the log fully recovered. Exit here and let the
+# fsck operation of xfstests to check the consistence of the tested filesystem.
+# On the buggy kernel, this testcase reports filesystem is inconsistent.
+# 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