All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] common/filter: filter out extra mount error output
@ 2022-05-27 12:11 Zorro Lang
  2022-06-06  4:05 ` Zorro Lang
  2022-06-06 13:07 ` Andrey Albershteyn
  0 siblings, 2 replies; 3+ messages in thread
From: Zorro Lang @ 2022-05-27 12:11 UTC (permalink / raw)
  To: fstests; +Cc: david

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] common/filter: filter out extra mount error output
  2022-05-27 12:11 [PATCH v2] common/filter: filter out extra mount error output Zorro Lang
@ 2022-06-06  4:05 ` Zorro Lang
  2022-06-06 13:07 ` Andrey Albershteyn
  1 sibling, 0 replies; 3+ messages in thread
From: Zorro Lang @ 2022-06-06  4:05 UTC (permalink / raw)
  To: fstests

On Fri, May 27, 2022 at 08:11:15PM +0800, Zorro Lang wrote:
> 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.

Ping, hope to get review :)

> 
> 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
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] common/filter: filter out extra mount error output
  2022-05-27 12:11 [PATCH v2] common/filter: filter out extra mount error output Zorro Lang
  2022-06-06  4:05 ` Zorro Lang
@ 2022-06-06 13:07 ` Andrey Albershteyn
  1 sibling, 0 replies; 3+ messages in thread
From: Andrey Albershteyn @ 2022-06-06 13:07 UTC (permalink / raw)
  To: Zorro Lang; +Cc: fstests

On Fri, May 27, 2022 at 08:11:15PM +0800, Zorro Lang wrote:
> 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
> 

Looks good to me,
Reviewed-by: Andrey Albershteyn <aalbersh@redhat.com>

-- 
- Andrey


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-06 13:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-27 12:11 [PATCH v2] common/filter: filter out extra mount error output Zorro Lang
2022-06-06  4:05 ` Zorro Lang
2022-06-06 13:07 ` Andrey Albershteyn

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.