Skip to contentSkip to conversation

common/filter: filter out extra mount error output

PATCH In review Zorro Lang 3 participants 3 messages May 27, 2022 – Jun 6, 2022

lore
Share & tools
lore

Zorro Lang

author
#0 lore raw

PATCH v2 1/1 common/filter: filter out extra mount error output

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.

---

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(-)
common/filter +11 -2
index a6a42b7a..14f6a027 100644
@@ -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
 }
tests/xfs/154 +1 -1
index 3f90a397..548c9490 100755
@@ -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
tests/xfs/154.out +1 -1
index 12f154ab..1263f091 100644
@@ -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
tests/xfs/158 +1 -1
index 505a9c73..4440adf6 100755
@@ -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
tests/xfs/158.out +1 -1
index 4f9dfd08..5461031a 100644
@@ -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
Signature · 1 line
2.31.1
#1 lore raw
Quoted 13 lines · Zorro Lang

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.

Quoted 6 lines

---

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.

Ping, hope to get review :)

Quoted 117 lines

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(-)
common/filter +11 -2
index a6a42b7a..14f6a027 100644
@@ -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
 }
tests/xfs/154 +1 -1
index 3f90a397..548c9490 100755
@@ -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
tests/xfs/154.out +1 -1
index 12f154ab..1263f091 100644
@@ -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
tests/xfs/158 +1 -1
index 505a9c73..4440adf6 100755
@@ -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
tests/xfs/158.out +1 -1
index 4f9dfd08..5461031a 100644
@@ -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
Signature · 1 line
2.31.1
Reviewed-by on v2 1/1
#2 lore raw
In reply to Zorro Lang
Quoted 136 lines · Zorro Lang

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.

---

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(-)
common/filter +11 -2
index a6a42b7a..14f6a027 100644
@@ -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
 }
tests/xfs/154 +1 -1
index 3f90a397..548c9490 100755
@@ -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
tests/xfs/154.out +1 -1
index 12f154ab..1263f091 100644
@@ -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
tests/xfs/158 +1 -1
index 505a9c73..4440adf6 100755
@@ -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
tests/xfs/158.out +1 -1
index 4f9dfd08..5461031a 100644
@@ -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
Signature · 1 line
2.31.1

Looks good to me,

Signature · 1 line
- Andrey