From: Zorro Lang <zlang@kernel.org>
To: fstests@vger.kernel.org
Cc: david@fromorbit.com
Subject: [PATCH v2] common/filter: filter out extra mount error output
Date: Fri, 27 May 2022 20:11:15 +0800 [thread overview]
Message-ID: <20220527121115.34358-1-zlang@kernel.org> (raw)
The lastest mount command (from util-linux) merged below commit:
79534c0d7e0f ("mount: add hint about dmesg(8) to error messages")
which brought in a new error output when mount fails, no matter
ro/rw/busy mount fails.
That cause some cases (e.g. xfs/005) fail as:
mount: Structure needs cleaning
dmesg(1) may have more information after failed mount system call
More failed cases like generic/050, ext4/002, xfs/154, xfs/158 etc.
Especially xfs/154 and xfs/158, need to change their _filter_scratch
to _filter_error_mount.
Signed-off-by: Zorro Lang <zlang@kernel.org>
---
Thanks the review points from Dave. This V2 turn to filter out the error in
_filter_error/ro/busy_mount. And change xfs/154 and xfs/158 to use
_filter_error_mount.
Thanks,
Zorro
common/filter | 13 +++++++++++--
tests/xfs/154 | 2 +-
tests/xfs/154.out | 2 +-
tests/xfs/158 | 2 +-
tests/xfs/158.out | 2 +-
5 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/common/filter b/common/filter
index a6a42b7a..14f6a027 100644
--- a/common/filter
+++ b/common/filter
@@ -380,6 +380,8 @@ _filter_ending_dot()
# ancient: mount: cannot remount block device <device> read-write, is write-protected
# prior to v2.30: mount: cannot remount <device> read-write, is write-protected
# v2.30 and later: mount: <mountpoint>: cannot remount <device> read-write, is write-protected.
+# v2.38 and later:
+# dmesg(1) may have more information after failed mount mount system call
#
# Now use _filter_ro_mount to unify all these differences across old & new
# util-linux versions. So the filtered format would be:
@@ -412,7 +414,8 @@ _filter_ro_mount() {
print "mount: cannot remount device read-write, is write-protected\n";
} else {
print "$_";
- }' | _filter_ending_dot
+ }' | grep -v "dmesg(1) may have more information after failed mount" | \
+ _filter_ending_dot
}
# Filter a failed mount output due to EUCLEAN and USTALE, util-linux changed
@@ -424,6 +427,8 @@ _filter_ro_mount() {
# mount: mount <device> on <mountpoint> failed: Structure needs cleaning
# v2.30 and later:
# mount: <mountpoint>: mount(2) system call failed: Structure needs cleaning.
+# v2.38 and later:
+# dmesg(1) may have more information after failed mount mount system call
#
# This is also true for ESTALE error. So let's remove all the changing parts
# and keep the 'prior to v2.21' format:
@@ -431,7 +436,8 @@ _filter_ro_mount() {
# mount: Stale file handle
_filter_error_mount()
{
- sed -e "s/mount:\(.*failed:\)/mount:/" | _filter_ending_dot
+ grep -v "dmesg(1) may have more information after failed mount" | \
+ sed -e "s/mount:\(.*failed:\)/mount:/" | _filter_ending_dot
}
# Similar to _filter_error_mount, filter a busy mount output.
@@ -440,8 +446,11 @@ _filter_error_mount()
# old: mount: <device> is already mounted or <mountpoint> busy
# new: mount: <mountpoint>: <device> already mounted or mount point busy.
# filtered: mount: device already mounted or mount point busy
+# v2.38 and later, filter out:
+# dmesg(1) may have more information after failed mount mount system call
_filter_busy_mount()
{
+ grep -v "dmesg(1) may have more information after failed mount" | \
sed -e "s/.*: .* already mounted or .* busy/mount: device already mounted or mount point busy/" | \
_filter_ending_dot
}
diff --git a/tests/xfs/154 b/tests/xfs/154
index 3f90a397..548c9490 100755
--- a/tests/xfs/154
+++ b/tests/xfs/154
@@ -48,7 +48,7 @@ test $? -eq 137 || echo "repair should have been killed??"
_check_scratch_xfs_features NEEDSREPAIR
_try_scratch_mount &> $tmp.mount
res=$?
-_filter_scratch < $tmp.mount
+_filter_error_mount < $tmp.mount
if [ $res -eq 0 ]; then
echo "Should not be able to mount after needsrepair crash"
_scratch_unmount
diff --git a/tests/xfs/154.out b/tests/xfs/154.out
index 12f154ab..1263f091 100644
--- a/tests/xfs/154.out
+++ b/tests/xfs/154.out
@@ -1,4 +1,4 @@
QA output created by 154
FEATURES: NEEDSREPAIR:YES
-mount: SCRATCH_MNT: mount(2) system call failed: Structure needs cleaning.
+mount: Structure needs cleaning
FEATURES: NEEDSREPAIR:NO
diff --git a/tests/xfs/158 b/tests/xfs/158
index 505a9c73..4440adf6 100755
--- a/tests/xfs/158
+++ b/tests/xfs/158
@@ -51,7 +51,7 @@ test $? -eq 137 || echo "repair should have been killed??"
_check_scratch_xfs_features NEEDSREPAIR INOBTCNT
_try_scratch_mount &> $tmp.mount
res=$?
-_filter_scratch < $tmp.mount
+_filter_error_mount < $tmp.mount
if [ $res -eq 0 ]; then
echo "needsrepair should have prevented mount"
_scratch_unmount
diff --git a/tests/xfs/158.out b/tests/xfs/158.out
index 4f9dfd08..5461031a 100644
--- a/tests/xfs/158.out
+++ b/tests/xfs/158.out
@@ -8,7 +8,7 @@ FEATURES: INOBTCNT:NO
Fail partway through upgrading
Adding inode btree counts to filesystem.
FEATURES: NEEDSREPAIR:YES INOBTCNT:YES
-mount: SCRATCH_MNT: mount(2) system call failed: Structure needs cleaning.
+mount: Structure needs cleaning
Re-run repair to finish upgrade
FEATURES: NEEDSREPAIR:NO INOBTCNT:YES
Filesystem should be usable again
--
2.31.1
next reply other threads:[~2022-05-27 12:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-27 12:11 Zorro Lang [this message]
2022-06-06 4:05 ` [PATCH v2] common/filter: filter out extra mount error output Zorro Lang
2022-06-06 13:07 ` Andrey Albershteyn
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=20220527121115.34358-1-zlang@kernel.org \
--to=zlang@kernel.org \
--cc=david@fromorbit.com \
--cc=fstests@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