From: Eryu Guan <eguan@redhat.com>
To: fstests@vger.kernel.org
Cc: misono.tomohiro@jp.fujitsu.com, linux-xfs@vger.kernel.org,
amir73il@gmail.com, Eryu Guan <eguan@redhat.com>
Subject: [PATCH v3 1/3] fstests: filter mount error message for EUCLEAN and ESTALE
Date: Thu, 23 Nov 2017 19:10:29 +0800 [thread overview]
Message-ID: <20171123111031.6550-2-eguan@redhat.com> (raw)
In-Reply-To: <20171123111031.6550-1-eguan@redhat.com>
util-linux commit ea848180dd34 ("libmount: add
mnt_context_get_excode()") since v2.30 changed the error message on
EUCLEAN and ESTALE again (and maybe other errno too):
- mount: <device> on <mountpoint> failed: Structure needs cleaning
+ mount: <mountpoint>: mount(2) system call failed: Structure needs cleaning.
and it causes xfs/005, overlay/037 to fail (and probably xfs/333 too,
but it's always _notrun for now).
And what's more, the mentioned tests would also fail when testing
with util-linux prior to v2.21, no one complained just because the
tests are usually _notrun on such old distributions that ship
util-linux < v2.21.
So let's filter out the changing parts and keep the error message
simple.
Signed-off-by: Eryu Guan <eguan@redhat.com>
---
v3:
- update commit log to mention potential test failure using
util-linux < v2.21
- document the filtered format as comments
common/filter | 26 ++++++++++++++++++++++++++
tests/overlay/037 | 4 ++--
tests/overlay/037.out | 4 ++--
tests/xfs/005 | 7 +------
tests/xfs/333 | 2 +-
tests/xfs/333.out | 2 +-
6 files changed, 33 insertions(+), 12 deletions(-)
diff --git a/common/filter b/common/filter
index 0cb458b0051f..0d3875cc6cdc 100644
--- a/common/filter
+++ b/common/filter
@@ -390,6 +390,13 @@ _filter_fstrim()
egrep -o "[0-9]+ bytes" | $AWK_PROG '{print $1}'
}
+# Remove the ending dot appended to mount error message, util-linux 2.30
+# starts to do so.
+_filter_ending_dot()
+{
+ sed -e "s/\.$//"
+}
+
# Older mount output referred to "block device" when mounting RO devices
# It's gone in newer versions
_filter_ro_mount() {
@@ -397,6 +404,25 @@ _filter_ro_mount() {
-e "s/mount: cannot mount block device/mount: cannot mount/g"
}
+# Filter a failed mount output due to EUCLEAN and USTALE, util-linux changed
+# the message several times.
+#
+# prior to v2.21:
+# mount: Structure needs cleaning
+# v2.21 to v2.29:
+# mount: mount <device> on <mountpoint> failed: Structure needs cleaning
+# v2.30 and later:
+# mount: <mountpoint>: mount(2) system call failed: Structure needs cleaning.
+#
+# This is also true for ESTALE error. So let's remove all the changing parts
+# and keep the 'prior to v2.21' format:
+# mount: Structure needs cleaning
+# mount: Stale file handle
+_filter_error_mount()
+{
+ sed -e "s/mount:\(.*failed:\)/mount:/" | _filter_ending_dot
+}
+
_filter_od()
{
BLOCK_SIZE=$(_get_block_size $SCRATCH_MNT)
diff --git a/tests/overlay/037 b/tests/overlay/037
index 728732903358..6710ddaf4802 100755
--- a/tests/overlay/037
+++ b/tests/overlay/037
@@ -76,12 +76,12 @@ $UMOUNT_PROG $SCRATCH_MNT
# Try to mount an overlay with the same upperdir and different lowerdir - expect ESTALE
_overlay_scratch_mount_dirs $lowerdir2 $upperdir $workdir -oindex=on \
- 2>&1 | _filter_scratch
+ 2>&1 | _filter_error_mount
$UMOUNT_PROG $SCRATCH_MNT 2>/dev/null
# Try to mount an overlay with the same workdir and different upperdir - expect ESTALE
_overlay_scratch_mount_dirs $lowerdir $upperdir2 $workdir -oindex=on \
- 2>&1 | _filter_scratch
+ 2>&1 | _filter_error_mount
$UMOUNT_PROG $SCRATCH_MNT 2>/dev/null
# Mount overlay with original lowerdir, upperdir, workdir and index=on - expect success
diff --git a/tests/overlay/037.out b/tests/overlay/037.out
index 786ef85c29e3..d6ad7cfad687 100644
--- a/tests/overlay/037.out
+++ b/tests/overlay/037.out
@@ -1,3 +1,3 @@
QA output created by 037
-mount: mount SCRATCH_DEV on SCRATCH_MNT failed: Stale file handle
-mount: mount SCRATCH_DEV on SCRATCH_MNT failed: Stale file handle
+mount: Stale file handle
+mount: Stale file handle
diff --git a/tests/xfs/005 b/tests/xfs/005
index fade4bbf282b..ebf4b15ec9b5 100755
--- a/tests/xfs/005
+++ b/tests/xfs/005
@@ -40,11 +40,6 @@ _cleanup()
rm -f $tmp.*
}
-filter_mount()
-{
- sed -e "s/mount .* failed: //"
-}
-
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
@@ -64,7 +59,7 @@ _scratch_mkfs_xfs -m crc=1 >> $seqres.full 2>&1 || _fail "mkfs failed"
$XFS_IO_PROG -c "pwrite 224 4" -c fsync $SCRATCH_DEV | _filter_xfs_io
# should FAIL, the crc is bad; golden output contains mount failure
-_scratch_mount 2>&1 | filter_mount
+_scratch_mount 2>&1 | _filter_error_mount
# success, all done
status=0
diff --git a/tests/xfs/333 b/tests/xfs/333
index bf0c811d2435..2f394feda6c9 100755
--- a/tests/xfs/333
+++ b/tests/xfs/333
@@ -64,7 +64,7 @@ _scratch_unmount
echo "Corrupt fs"
_scratch_xfs_db -x -c 'sb 0' -c "write rrmapino $ino" >> $seqres.full
-_scratch_mount 2>&1 | _filter_scratch
+_scratch_mount 2>&1 | _filter_error_mount
echo "Test done, mount should have failed"
diff --git a/tests/xfs/333.out b/tests/xfs/333.out
index f7518f46d900..b3c698750f8f 100644
--- a/tests/xfs/333.out
+++ b/tests/xfs/333.out
@@ -2,5 +2,5 @@ QA output created by 333
Format and mount
Create some files
Corrupt fs
-mount: mount SCRATCH_DEV on SCRATCH_MNT failed: Structure needs cleaning
+mount: Structure needs cleaning
Test done, mount should have failed
--
2.14.3
next prev parent reply other threads:[~2017-11-23 11:10 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-23 11:10 [PATCH v3 0/3] fix failures caused by mount error msg change in util-linux v2.30 Eryu Guan
2017-11-23 11:10 ` Eryu Guan [this message]
2017-11-23 11:10 ` [PATCH v3 2/3] overlay/036: filter busy mount message Eryu Guan
2017-11-23 11:10 ` [PATCH v3 3/3] fstests: filter readonly mount error messages Eryu Guan
2017-11-23 13:28 ` Amir Goldstein
2017-11-23 13:34 ` Amir Goldstein
2017-11-23 14:09 ` Eryu Guan
2017-11-24 5:01 ` [PATCH v4] " Eryu Guan
2017-11-24 8:04 ` Amir Goldstein
2017-11-24 10:38 ` Karel Zak
2017-11-26 8:56 ` Amir Goldstein
2017-11-27 10:54 ` Karel Zak
2017-11-28 7:52 ` Eryu Guan
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=20171123111031.6550-2-eguan@redhat.com \
--to=eguan@redhat.com \
--cc=amir73il@gmail.com \
--cc=fstests@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=misono.tomohiro@jp.fujitsu.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;
as well as URLs for NNTP newsgroup(s).