linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: guaneryu@gmail.com, darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org
Subject: [PATCH 1/2] common/dmerror: always try to resume device
Date: Tue, 10 Dec 2019 21:38:31 -0800	[thread overview]
Message-ID: <157604271185.578515.14919906805385029384.stgit@magnolia> (raw)
In-Reply-To: <157604270553.578515.11375769780919670829.stgit@magnolia>

From: Darrick J. Wong <darrick.wong@oracle.com>

When we're reloading the error-target dm table, always resume the device
even if the reload fails because (a) we shouldn't leave dm state for the
callers to clean up and (b) the caller don't clean up the state which
just leads to the scratch filesystem hanging on the suspended dm error
device.  Resume the dm device when we're cleaning up so that cleaning up
the scratch filesystem won't hang.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/dmerror |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)


diff --git a/common/dmerror b/common/dmerror
index 8c52e127..ca1c7335 100644
--- a/common/dmerror
+++ b/common/dmerror
@@ -44,6 +44,7 @@ _dmerror_unmount()
 
 _dmerror_cleanup()
 {
+	$DMSETUP_PROG resume error-test > /dev/null 2>&1
 	$UMOUNT_PROG $SCRATCH_MNT > /dev/null 2>&1
 	_dmsetup_remove error-test
 }
@@ -62,10 +63,13 @@ _dmerror_load_error_table()
 	[ $? -ne 0 ] && _fail  "dmsetup suspend failed"
 
 	$DMSETUP_PROG load error-test --table "$DMERROR_TABLE"
-	[ $? -ne 0 ] && _fail "dmsetup failed to load error table"
+	load_res=$?
 
 	$DMSETUP_PROG resume error-test
-	[ $? -ne 0 ] && _fail  "dmsetup resume failed"
+	resume_res=$?
+
+	[ $load_res -ne 0 ] && _fail "dmsetup failed to load error table"
+	[ $resume_res -ne 0 ] && _fail  "dmsetup resume failed"
 }
 
 _dmerror_load_working_table()
@@ -82,8 +86,11 @@ _dmerror_load_working_table()
 	[ $? -ne 0 ] && _fail  "dmsetup suspend failed"
 
 	$DMSETUP_PROG load error-test --table "$DMLINEAR_TABLE"
-	[ $? -ne 0 ] && _fail "dmsetup failed to load error table"
+	load_res=$?
 
 	$DMSETUP_PROG resume error-test
-	[ $? -ne 0 ] && _fail  "dmsetup resume failed"
+	resume_res=$?
+
+	[ $load_res -ne 0 ] && _fail "dmsetup failed to load error table"
+	[ $resume_res -ne 0 ] && _fail  "dmsetup resume failed"
 }


  reply	other threads:[~2019-12-11  5:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-11  5:38 [PATCH 0/2] xfs: test xfs_scrub media scan Darrick J. Wong
2019-12-11  5:38 ` Darrick J. Wong [this message]
2019-12-11  5:38 ` [PATCH 2/2] xfs: test xfs_scrub phase 6 media error reporting Darrick J. Wong
2020-01-06  7:58   ` Eryu Guan
2020-01-06 18:10     ` Darrick J. Wong

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=157604271185.578515.14919906805385029384.stgit@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=fstests@vger.kernel.org \
    --cc=guaneryu@gmail.com \
    --cc=linux-xfs@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).