]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
common/filter: filter out extra mount error output
authorZorro Lang <zlang@kernel.org>
Fri, 27 May 2022 12:11:15 +0000 (20:11 +0800)
committerZorro Lang <zlang@kernel.org>
Fri, 10 Jun 2022 17:21:35 +0000 (01:21 +0800)
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>
Reviewed-by: Andrey Albershteyn <aalbersh@redhat.com>
common/filter
tests/xfs/154
tests/xfs/154.out
tests/xfs/158
tests/xfs/158.out

index a6a42b7a6ad25873fd374d59ea9ce1512ec9c6d3..14f6a02782326d831de610eaef5f59d376164a09 100644 (file)
@@ -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
 }
index 3f90a397d843acc2635d56c7b7ffcb77fa241505..548c94905f5b03452ee7a10aece853181bf18101 100755 (executable)
@@ -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
index 12f154abd07f2676a8dbae89562e48d1c093eb2c..1263f091ffa02e56303b028340c65f3986a26ec2 100644 (file)
@@ -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
index 505a9c73286ca1d07be43b7e911cd7c1194d749d..4440adf6ee5723f727ddb5da766b8a933f1057b0 100755 (executable)
@@ -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
index 4f9dfd0882c8d24aa12354531f60b750597936ac..5461031a38d4e0f509f46c608c5a8294d7e9509c 100644 (file)
@@ -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