All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: zlang@redhat.com, djwong@kernel.org
Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me
Subject: [PATCH 2/2] generic/500: skip this test if formatting fails
Date: Tue, 31 Jan 2023 16:51:40 -0800	[thread overview]
Message-ID: <167521270079.2382722.2799074346773170090.stgit@magnolia> (raw)
In-Reply-To: <167521268927.2382722.13701066927653225895.stgit@magnolia>

From: Darrick J. Wong <djwong@kernel.org>

This testcase exercises what happens when we race a filesystem
perforing discard operations against a thin provisioning device that has
run out of space.  To constrain runtime, it creates a 128M thinp volume
and formats it.

However, if that initial format fails because (say) the 128M volume is
too small, then the test fails.  This is really a case of test
preconditions not being satisfied, so let's make the test _notrun when
this happens.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 common/dmthin     |    7 ++++-
 common/rc         |   80 +++++++++++++++++++++++++++--------------------------
 tests/generic/500 |    3 +-
 3 files changed, 48 insertions(+), 42 deletions(-)


diff --git a/common/dmthin b/common/dmthin
index 91147e47ac..7107d50804 100644
--- a/common/dmthin
+++ b/common/dmthin
@@ -234,5 +234,10 @@ _dmthin_mount()
 _dmthin_mkfs()
 {
 	_scratch_options mkfs
-	_mkfs_dev $SCRATCH_OPTIONS $@ $DMTHIN_VOL_DEV
+	_mkfs_dev $SCRATCH_OPTIONS "$@" $DMTHIN_VOL_DEV
+}
+_dmthin_try_mkfs()
+{
+	_scratch_options mkfs
+	_try_mkfs_dev $SCRATCH_OPTIONS "$@" $DMTHIN_VOL_DEV
 }
diff --git a/common/rc b/common/rc
index 36eb90e1f1..376a0138b4 100644
--- a/common/rc
+++ b/common/rc
@@ -604,49 +604,49 @@ _test_mkfs()
     esac
 }
 
+_try_mkfs_dev()
+{
+    case $FSTYP in
+    nfs*)
+	# do nothing for nfs
+	;;
+    9p)
+	# do nothing for 9p
+	;;
+    fuse)
+	# do nothing for fuse
+	;;
+    virtiofs)
+	# do nothing for virtiofs
+	;;
+    overlay)
+	# do nothing for overlay
+	;;
+    pvfs2)
+	# do nothing for pvfs2
+	;;
+    udf)
+        $MKFS_UDF_PROG $MKFS_OPTIONS $*
+	;;
+    btrfs)
+        $MKFS_BTRFS_PROG $MKFS_OPTIONS $*
+	;;
+    ext2|ext3|ext4)
+	$MKFS_PROG -t $FSTYP -- -F $MKFS_OPTIONS $*
+	;;
+    xfs)
+	$MKFS_PROG -t $FSTYP -- -f $MKFS_OPTIONS $*
+	;;
+    *)
+	yes | $MKFS_PROG -t $FSTYP -- $MKFS_OPTIONS $*
+	;;
+    esac
+}
+
 _mkfs_dev()
 {
     local tmp=`mktemp -u`
-    case $FSTYP in
-    nfs*)
-	# do nothing for nfs
-	;;
-    9p)
-	# do nothing for 9p
-	;;
-    fuse)
-	# do nothing for fuse
-	;;
-    virtiofs)
-	# do nothing for virtiofs
-	;;
-    overlay)
-	# do nothing for overlay
-	;;
-    pvfs2)
-	# do nothing for pvfs2
-	;;
-    udf)
-        $MKFS_UDF_PROG $MKFS_OPTIONS $* 2>$tmp.mkfserr 1>$tmp.mkfsstd
-	;;
-    btrfs)
-        $MKFS_BTRFS_PROG $MKFS_OPTIONS $* 2>$tmp.mkfserr 1>$tmp.mkfsstd
-	;;
-    ext2|ext3|ext4)
-	$MKFS_PROG -t $FSTYP -- -F $MKFS_OPTIONS $* \
-		2>$tmp.mkfserr 1>$tmp.mkfsstd
-	;;
-    xfs)
-	$MKFS_PROG -t $FSTYP -- -f $MKFS_OPTIONS $* \
-		2>$tmp.mkfserr 1>$tmp.mkfsstd
-	;;
-    *)
-	yes | $MKFS_PROG -t $FSTYP -- $MKFS_OPTIONS $* \
-		2>$tmp.mkfserr 1>$tmp.mkfsstd
-	;;
-    esac
-
-    if [ $? -ne 0 ]; then
+    if ! _try_mkfs_dev "$@" 2>$tmp.mkfserr 1>$tmp.mkfsstd; then
 	# output stored mkfs output
 	cat $tmp.mkfserr >&2
 	cat $tmp.mkfsstd
diff --git a/tests/generic/500 b/tests/generic/500
index bc84d219fa..1151c8f234 100755
--- a/tests/generic/500
+++ b/tests/generic/500
@@ -58,7 +58,8 @@ CLUSTER_SIZE=$((64 * 1024 / 512))		# 64K
 
 _dmthin_init $BACKING_SIZE $VIRTUAL_SIZE $CLUSTER_SIZE 0
 _dmthin_set_fail
-_dmthin_mkfs
+_dmthin_try_mkfs >> $seqres.full 2>&1 || \
+	_notrun "Could not format small thinp filesystem for test"
 _dmthin_mount
 
 # There're two bugs at here, one is dm-thin bug, the other is filesystem


  parent reply	other threads:[~2023-02-01  0:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-01  0:51 [PATCHSET 0/2] fstests: random fixes for v2023.01.22 Darrick J. Wong
2023-02-01  0:51 ` [PATCH 1/2] generic/038: set a maximum runtime on this test Darrick J. Wong
2023-02-02  9:53   ` Zorro Lang
2023-02-01  0:51 ` Darrick J. Wong [this message]
2023-02-02 10:00   ` [PATCH 2/2] generic/500: skip this test if formatting fails Zorro Lang
2023-02-02 17:04     ` 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=167521270079.2382722.2799074346773170090.stgit@magnolia \
    --to=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=guan@eryu.me \
    --cc=linux-xfs@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 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.