Re: [PATCH] overlay: add test for lowerdir mount option parsing

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

 



On Fri, Oct 20, 2023 at 07:18:55PM +0300, Amir Goldstein wrote:
> On Thu, Oct 19, 2023 at 8:50 PM Zorro Lang <zlang@xxxxxxxxxx> wrote:
> >
> > On Tue, Oct 17, 2023 at 01:11:45PM +0300, Amir Goldstein wrote:
> > > Check parsing and display of spaces and escaped colons and commans in
> > > lowerdir mount option.
> > >
> > > This is a regression test for two bugs introduced in v6.5 with the
> > > conversion to new mount api.
> > >
> > > Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx>
> > > ---
> > >
> > > Zorro,
> > >
> > > This is a test for two regressions in kernel v6.5.
> > > The two fixes were merged in 6.6-rc6 and have been picked for
> > > the upcoming LTS 6.5.y release.
> >
> >
> > >
> > > Thanks,
> > > Amir.
> > >
> > >  tests/overlay/083     | 54 +++++++++++++++++++++++++++++++++++++++++++
> > >  tests/overlay/083.out |  2 ++
> > >  2 files changed, 56 insertions(+)
> > >  create mode 100755 tests/overlay/083
> > >  create mode 100644 tests/overlay/083.out
> > >
> > > diff --git a/tests/overlay/083 b/tests/overlay/083
> > > new file mode 100755
> > > index 00000000..071b4b84
> > > --- /dev/null
> > > +++ b/tests/overlay/083
> > > @@ -0,0 +1,54 @@
> > > +#! /bin/bash
> > > +# SPDX-License-Identifier: GPL-2.0
> > > +# Copyright (C) 2023 CTERA Networks. All Rights Reserved.
> > > +#
> > > +# FS QA Test 083
> > > +#
> > > +# Test regressions in parsing and display of special chars in mount options.
> > > +#
> > > +# The following kernel commits from v6.5 introduced regressions:
> > > +#  b36a5780cb44 ("ovl: modify layer parameter parsing")
> > > +#  1784fbc2ed9c ("ovl: port to new mount api")
> > > +#
> > > +
> > > +. ./common/preamble
> > > +_begin_fstest auto quick mount
> > > +
> > > +# Import common functions.
> > > +. ./common/filter
> > > +
> > > +# real QA test starts here
> > > +_supported_fs overlay
> > > +_fixed_by_kernel_commit 32db51070850 \
> > > +     "ovl: fix regression in showing lowerdir mount option"
> > > +_fixed_by_kernel_commit c34706acf40b \
> > > +     "ovl: fix regression in parsing of mount options with escaped comma"
> >
> > Hi Amir,
> >
> > I tried this case on the latest linux kernel which contains the
> > two commits, but still hit below failure:
> >
> > FSTYP         -- overlay
> > PLATFORM      -- Linux/x86_64 hp-dl380pg8-01 6.6.0-rc6-mainline+ #7 SMP PREEMPT_DYNAMIC Thu Oct 19 22:34:28 CST 2023
> > MKFS_OPTIONS  -- /mnt/scratch
> > MOUNT_OPTIONS -- -o context=system_u:object_r:root_t:s0 /mnt/scratch /mnt/scratch/ovl-mnt
> >
> > overlay/083       - output mismatch (see /root/git/xfstests/results//overlay/083.out.bad)
> >     --- tests/overlay/083.out   2023-10-19 14:07:18.099496414 +0800
> >     +++ /root/git/xfstests/results//overlay/083.out.bad 2023-10-20 00:25:47.682874383 +0800
> >     @@ -1,2 +1,4 @@
> >      QA output created by 083
> >     +mount: /mnt/scratch/ovl-mnt: special device ovl_esc_test does not exist.
> >     +       dmesg(1) may have more information after failed mount system call.
> >      Silence is golden
> >
> 
> Strange.
> I was under the impression that the 'dev' argument to mount command
> of overlayfs is a completely opaque string.
> 
> Maybe you are using a different libmount version that I do.
> I have libmount 2.36.1.

I'm using Fedora rawhide, the libmount version is libmount-2.39.2-1.fc40.

> 
> Anyway, can you please try if this variation works for you:
> 
> --- a/tests/overlay/083
> +++ b/tests/overlay/083
> @@ -42,12 +42,12 @@ mkdir -p "$lowerdir1" "$lowerdir2" "$lowerdir3"
> 
>  # _overlay_mount_* helpers do not handle special chars well, so
> execute mount directly.
>  # if escaped colons and commas are not parsed correctly, mount will fail.
> -$MOUNT_PROG -t overlay ovl_esc_test $SCRATCH_MNT \
> +$MOUNT_PROG -t overlay $OVL_BASE_SCRATCH_MNT $SCRATCH_MNT \

I doubt it works. This looks like to try to mount /mnt/scratch on
/mnt/scratch/ovl-mnt.

Thanks,
Zorro

>         -o"upperdir=$upperdir,workdir=$workdir,lowerdir=$lowerdir3_esc:$lowerdir2_esc:$lowerdir1"
> 
>  # if spaces are not escaped when showing mount options,
>  # mount command will not show the word 'spaces' after the spaces
> -$MOUNT_PROG -t overlay | grep ovl_esc_test  | tee -a $seqres.full |
> grep -v spaces
> +$MOUNT_PROG -t overlay | grep lower3 | tee -a $seqres.full | grep -v spaces
> 
> Thanks,
> Amir.
> 
> >
> > > +
> > > +# _overlay_check_* helpers do not handle special chars well
> > > +_require_scratch_nocheck
> > > +
> > > +# Remove all files from previous tests
> > > +_scratch_mkfs
> > > +
> > > +# Create lowerdirs with special characters
> > > +lowerdir1="$OVL_BASE_SCRATCH_MNT/lower1 with  spaces"
> > > +lowerdir2="$OVL_BASE_SCRATCH_MNT/lower2:with::colons"
> > > +lowerdir3="$OVL_BASE_SCRATCH_MNT/lower3,with,,commas"
> > > +lowerdir2_esc="$OVL_BASE_SCRATCH_MNT/lower2\:with\:\:colons"
> > > +lowerdir3_esc="$OVL_BASE_SCRATCH_MNT/lower3\,with\,\,commas"
> > > +upperdir=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER
> > > +workdir=$OVL_BASE_SCRATCH_MNT/$OVL_WORK
> > > +mkdir -p "$lowerdir1" "$lowerdir2" "$lowerdir3"
> > > +
> > > +# _overlay_mount_* helpers do not handle special chars well, so execute mount directly.
> > > +# if escaped colons and commas are not parsed correctly, mount will fail.
> > > +$MOUNT_PROG -t overlay ovl_esc_test $SCRATCH_MNT \
> > > +     -o"upperdir=$upperdir,workdir=$workdir,lowerdir=$lowerdir3_esc:$lowerdir2_esc:$lowerdir1"
> > > +
> > > +# if spaces are not escaped when showing mount options,
> > > +# mount command will not show the word 'spaces' after the spaces
> > > +$MOUNT_PROG -t overlay | grep ovl_esc_test  | tee -a $seqres.full | grep -v spaces
> > > +
> > > +echo "Silence is golden"
> > > +status=0
> > > +exit
> > > diff --git a/tests/overlay/083.out b/tests/overlay/083.out
> > > new file mode 100644
> > > index 00000000..0beba309
> > > --- /dev/null
> > > +++ b/tests/overlay/083.out
> > > @@ -0,0 +1,2 @@
> > > +QA output created by 083
> > > +Silence is golden
> > > --
> > > 2.34.1
> > >
> >
> 




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

  Powered by Linux