Re: [PATCH] common/rc: filter out extra mount error

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



On Fri, May 27, 2022 at 09:45:06AM +1000, Dave Chinner wrote:
> On Thu, May 26, 2022 at 05:57:04PM +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.
> > 
> > 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, etc ...
> > 
> > Signed-off-by: Zorro Lang <zlang@xxxxxxxxxx>
> > ---
> > 
> > Due to _try_scratch_mount is call in many places, so I'm not sure if it's good
> > to filter this message in _try_scratch_mount. Maybe better to filter it in each
> > failed cases? Or write another function (e.g. _try_scratch_mount_fail) ?
> > Welcome review points.
> > 
> > Thanks,
> > Zorro
> > 
> >  common/rc | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/common/rc b/common/rc
> > index 70a15f9c..67342760 100644
> > --- a/common/rc
> > +++ b/common/rc
> > @@ -335,7 +335,8 @@ _try_scratch_mount()
> >  		_overlay_scratch_mount $*
> >  		return $?
> >  	fi
> > -	_mount -t $FSTYP `_scratch_mount_options $*`
> > +	_mount -t $FSTYP `_scratch_mount_options $*`  2> \
> > +		>(grep -v "dmesg(1) may have more information after failed mount" >&2)
> 
> _filter_error_mount()?

OK, how about this change [1] ?

Do you think doing this "filter out" in _try_scratch_mount is better, or in
each case which expects mount failures in .out file (e.g. xfs/005) ? Or a new
_try_scratch_mount_fail() ?

Thanks,
Zorro

[1]
diff --git a/common/filter b/common/filter
index a6a42b7a..54fb8d68 100644
--- a/common/filter
+++ b/common/filter
@@ -655,5 +655,10 @@ _filter_blkzone_report()
        sed -e 's/len/cap/2'
 }
 
+_filter_mount_error()
+{
+       grep -v "dmesg(1) may have more information after failed mount"
+}
+
 # make sure this script returns success
 /bin/true
diff --git a/common/rc b/common/rc
index 2f31ca46..c16bd405 100644
--- a/common/rc
+++ b/common/rc
@@ -288,7 +288,8 @@ _try_scratch_mount()
                _overlay_scratch_mount $*
                return $?
        fi
-       _mount -t $FSTYP `_scratch_mount_options $*`
+       _mount -t $FSTYP `_scratch_mount_options $*` 2> \
+               >(_filter_mount_error >&2)
        mount_ret=$?
        [ $mount_ret -ne 0 ] && return $mount_ret
        _idmapped_mount $SCRATCH_DEV $SCRATCH_MNT

Thanks,
Zorro

> 
> Cheers,
> 
> Dave.
> -- 
> Dave Chinner
> david@xxxxxxxxxxxxx
> 




[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux