public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Xiao Yang <yangx.jy@cn.fujitsu.com>
To: fstests@vger.kernel.org
Cc: zlang@redhat.com, darrick.wong@oracle.com,
	Xiao Yang <yangx.jy@cn.fujitsu.com>
Subject: [PATCH v3] xfs/098: fix xfs_repair on newer xfsprogs
Date: Mon, 12 Sep 2016 13:13:57 +0800	[thread overview]
Message-ID: <1473657237-13148-1-git-send-email-yangx.jy@cn.fujitsu.com> (raw)
In-Reply-To: <20160909122831.GD12847@dhcp12-143.nay.redhat.com>

The obsolete xfs_repair always cleared the log regardless of whether it
is corrupted.   However current xfs_repair only cleared the log when -L
option is specified, so xfs_repair without any options failed to clear log
on newer xfsprogs.  If xfs_repair failed to clear log, xfs_repair -L option
should be used to clear it.

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

diff --git a/common/rc b/common/rc
index 04039a4..fda108c 100644
--- a/common/rc
+++ b/common/rc
@@ -1134,16 +1134,18 @@ _scratch_xfs_repair()
     $XFS_REPAIR_PROG $SCRATCH_OPTIONS $* $SCRATCH_DEV
 }
 
-# Repair scratch filesystem.  Returns 0 if the FS is good to go (either no
-# errors found or errors were fixed) and nonzero otherwise; also spits out
-# a complaint on stderr if fsck didn't tell us that the FS is good to go.
+# Repair scratch filesystem.  Return 2 if the filesystem has valuable
+# metadata changes in log which needs to be replayed, 1 if there's
+# corruption left to be fixed or can't find log head and tail or some
+# other errors happened, and 0 if nothing wrong or all the corruptions
+# were fixed.
 _repair_scratch_fs()
 {
     case $FSTYP in
     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..3743e78 100755
--- a/tests/xfs/098
+++ b/tests/xfs/098
@@ -93,7 +93,7 @@ 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
 
 echo "+ mount image (2)"
 _scratch_mount
-- 
1.8.3.1




  parent reply	other threads:[~2016-09-12  5:19 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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-12  1:07                 ` Xiao Yang
2016-09-12  5:13                 ` Xiao Yang [this message]
2016-09-12 12:59                   ` [PATCH v3] " 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

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=1473657237-13148-1-git-send-email-yangx.jy@cn.fujitsu.com \
    --to=yangx.jy@cn.fujitsu.com \
    --cc=darrick.wong@oracle.com \
    --cc=fstests@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