]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
generic: check log recovery with readonly mount
authorMurphy Zhou <xzhou@redhat.com>
Wed, 25 Aug 2021 03:26:30 +0000 (11:26 +0800)
committerEryu Guan <guaneryu@gmail.com>
Sun, 29 Aug 2021 14:23:47 +0000 (22:23 +0800)
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>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/generic/646 [new file with mode: 0755]
tests/generic/646.out [new file with mode: 0644]

diff --git a/tests/generic/646 b/tests/generic/646
new file mode 100755 (executable)
index 0000000..79d3f17
--- /dev/null
@@ -0,0 +1,42 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2021 RedHat All Rights Reserved.
+#
+# FS QA Test No. 646
+#
+# 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/646.out b/tests/generic/646.out
new file mode 100644 (file)
index 0000000..8357006
--- /dev/null
@@ -0,0 +1,2 @@
+QA output created by 646
+Silence is golden