All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs/098: fix xfs_repair on newer xfsprogs
@ 2016-08-25  9:22 Xiao Yang
  2016-08-25 12:09 ` Zorro Lang
  0 siblings, 1 reply; 24+ messages in thread
From: Xiao Yang @ 2016-08-25  9:22 UTC (permalink / raw)
  To: fstests; +Cc: darrick.wong, Xiao Yang

Make sure xfs_repair can't clear the log by default when it is corrupted.
xfs_repair always and only clear the log when the -L parameter is specified.
This has updated by:
Commit f2053bc ("xfs_repair: don't clear the log by default")

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 tests/xfs/098 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/xfs/098 b/tests/xfs/098
index d91d617..0fe8d93 100755
--- a/tests/xfs/098
+++ b/tests/xfs/098
@@ -93,7 +93,9 @@ echo "+ mount image"
 _scratch_mount 2>/dev/null && _fail "mount should not succeed"
 
 echo "+ repair fs"
-_scratch_xfs_repair >> $seqres.full 2>&1
+_scratch_xfs_repair >> $seqres.full 2>&1 && _fail "xfs_repair should not succeed without -L option"
+
+_scratch_xfs_repair -L >> $seqres.full 2>&1
 
 echo "+ mount image (2)"
 _scratch_mount
-- 
1.8.3.1




^ permalink raw reply related	[flat|nested] 24+ messages in thread
* [PATCH v4] xfs/098: fix xfs_repair on newer xfsprogs
@ 2016-09-14  2:49 Xiao Yang
  2016-09-14 17:33 ` Zorro Lang
  0 siblings, 1 reply; 24+ messages in thread
From: Xiao Yang @ 2016-09-14  2:49 UTC (permalink / raw)
  To: --in-reply-to=20160913070804.GF12847, fstests
  Cc: zlang, sandeen, darrick.wong, Xiao Yang

1) use _repair_scratch_fs instead of xfs_repair
   The obsolete xfs_repair always cleared the log regardless of whether
   it is corrupted and current xfs_repair only cleared the log when -L
   option is specified.  xfs_repair -L option should be used to clear it
   if xfs_repair failed to clear log.
2) catch non-zero return value instead of 2
   It can be applied to both the old return value 1 and the new return
   value 2
3) add filter_xfs_dmesg to ignore mount related warnings
   If we corrupt log and mount on a CONFIG_XFS_WARN build, there will be
   mount related warnings in dmesg as expected.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 common/rc     |  2 +-
 tests/xfs/098 | 16 +++++++++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/common/rc b/common/rc
index 13afc6a..655ae28 100644
--- a/common/rc
+++ b/common/rc
@@ -1152,7 +1152,7 @@ _repair_scratch_fs()
     xfs)
         _scratch_xfs_repair "$@" 2>&1
 	res=$?
-	if [ "$res" -eq 2 ]; then
+	if [ "$res" -ne 0 ]; then
 		echo "xfs_repair returns $res; replay log?"
 		_scratch_mount
 		res=$?
diff --git a/tests/xfs/098 b/tests/xfs/098
index d91d617..86ec62c 100755
--- a/tests/xfs/098
+++ b/tests/xfs/098
@@ -54,6 +54,17 @@ _require_xfs_db_blocktrash_z_command
 test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-n 8 -3"
 
 rm -f $seqres.full
+
+# If we corrupt log on a CONFIG_XFS_WARN build, there will be mount related
+# WARNINGs in dmesg as expected.  We don't want to simply _disable_dmesg_check
+# which could miss other potential bugs, so filter out the intentional WARNINGs,
+# make sure test doesn't fail because of this warning and fails on other WARNINGs.
+filter_xfs_dmesg()
+{
+	local warn="WARNING:.*fs/xfs/xfs_message\.c:.*asswarn.*"
+	sed -e "s#$warn#Intentional warnings in asswarn#"
+}
+
 TESTDIR="${SCRATCH_MNT}/scratchdir"
 TESTFILE="${TESTDIR}/testfile"
 
@@ -93,7 +104,10 @@ echo "+ mount image"
 _scratch_mount 2>/dev/null && _fail "mount should not succeed"
 
 echo "+ repair fs"
-_scratch_xfs_repair >> $seqres.full 2>&1
+_repair_scratch_fs >> $seqres.full 2>&1
+
+# mount may trigger related WARNINGs, so filter them.
+_check_dmesg filter_xfs_dmesg
 
 echo "+ mount image (2)"
 _scratch_mount
-- 
1.8.3.1




^ permalink raw reply related	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2016-09-14 17:33 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-25  9:22 [PATCH] xfs/098: fix xfs_repair on newer xfsprogs Xiao Yang
2016-08-25 12:09 ` Zorro Lang
2016-08-25 15:40   ` Darrick J. Wong
2016-08-25 16:32     ` Zorro Lang
2016-08-26  3:32     ` Xiao Yang
2016-08-26 16:18       ` Darrick J. Wong
2016-08-26  3:36     ` [PATCH v2] " Xiao Yang
2016-08-26  4:42       ` Eryu Guan
2016-08-26  5:44         ` Xiao Yang
2016-08-26  4:48       ` Zorro Lang
2016-08-26  6:10         ` Xiao Yang
2016-08-26  9:05           ` Zorro Lang
     [not found]             ` <57D28101.6000902@cn.fujitsu.com>
2016-09-09 12:28               ` Zorro Lang
2016-09-09 12:28                 ` Zorro Lang
2016-09-12  1:07                 ` Xiao Yang
2016-09-12  1:07                   ` Xiao Yang
2016-09-12  5:13                 ` [PATCH v3] " Xiao Yang
2016-09-12 12:59                   ` Eric Sandeen
2016-09-13  6:12                     ` Xiao Yang
2016-09-13  7:08                     ` Zorro Lang
2016-09-14  1:43                       ` Xiao Yang
2016-09-14  2:52                       ` [PATCH v4] " Xiao Yang
2016-09-14  2:49 Xiao Yang
2016-09-14 17:33 ` Zorro Lang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.