* [PATCH] overlay: copy-up lowerdir which has opaque xattr set
@ 2016-08-08 17:23 Eryu Guan
2016-08-09 4:09 ` Xiong Zhou
2016-08-09 6:37 ` Dave Chinner
0 siblings, 2 replies; 4+ messages in thread
From: Eryu Guan @ 2016-08-08 17:23 UTC (permalink / raw)
To: fstests; +Cc: linux-unionfs, xzhou, Eryu Guan
When copying up a directory with opaque xattr set, the xattr was
copied up as well, after a remount the opaque flag is honored so the
copied-up directory is treated as opaque, which causes files created
in the lowerdir to be hidden when using multiple lower directories.
This is fixed by "ovl: don't copy up opaqueness".
Signed-off-by: Eryu Guan <eguan@redhat.com>
---
tests/overlay/014 | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++
tests/overlay/014.out | 3 ++
tests/overlay/group | 1 +
3 files changed, 100 insertions(+)
create mode 100755 tests/overlay/014
create mode 100644 tests/overlay/014.out
diff --git a/tests/overlay/014 b/tests/overlay/014
new file mode 100755
index 0000000..d9d8b5d
--- /dev/null
+++ b/tests/overlay/014
@@ -0,0 +1,96 @@
+#! /bin/bash
+# FS QA Test 014
+#
+# Test copy-up of lowerdir with opaque xattr set.
+#
+# When copying up a directory with opaque xattr set, the xattr was copied up as
+# well, after a remount the opaque flag is honored so the copied-up directory
+# is treated as opaque, which causes files created in the lowerdir to be hidden
+# when using multiple lower directories.
+#
+# This is fixed by "ovl: don't copy up opaqueness".
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016 Red Hat Inc. All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1 # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+ cd /
+ rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/attr
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+_supported_fs overlay
+_supported_os Linux
+_require_test
+_require_scratch
+_require_attrs
+
+# Remove all files from previous tests
+_scratch_mkfs
+
+# Create multiple lowerdirs and upperdir, workdir, and testdir on lowerdir
+lowerdir1=$SCRATCH_DEV/lower1
+lowerdir2=$SCRATCH_DEV/lower2
+upperdir=$SCRATCH_DEV/upper
+workdir=$SCRATCH_DEV/workdir
+mkdir -p $lowerdir1 $lowerdir2 $upperdir $workdir
+mkdir -p $lowerdir1/testdir/d
+
+# mount overlay with $lowerdir2 as upperdir, and remove & recreate testdir,
+# make testdir on $lowerdir2 opaque
+$MOUNT_PROG -t overlay -o lowerdir=$lowerdir1,upperdir=$lowerdir2 \
+ -o workdir=$workdir none $SCRATCH_MNT
+rm -rf $SCRATCH_MNT/testdir
+mkdir -p $SCRATCH_MNT/testdir/visibledir
+$UMOUNT_PROG $SCRATCH_MNT
+
+# mount overlay again, with lowerdir1 and lowerdir2 as multiple lowerdirs,
+# and create a new file in testdir, triggers copyup from lowerdir,
+# copyup should not copy overlayfs private xattr
+$MOUNT_PROG -t overlay -o lowerdir=$lowerdir2:$lowerdir1,upperdir=$upperdir \
+ -o workdir=$workdir none $SCRATCH_MNT
+touch $SCRATCH_MNT/testdir/visiblefile
+
+# umount and mount overlay again, buggy kernel treats the copied-up dir as
+# opaque, visibledir is not seen in merged dir.
+$UMOUNT_PROG $SCRATCH_MNT
+$MOUNT_PROG -t overlay -o lowerdir=$lowerdir2:$lowerdir1,upperdir=$upperdir \
+ -o workdir=$workdir none $SCRATCH_MNT
+ls $SCRATCH_MNT/testdir
+
+# success, all done
+status=0
+exit
diff --git a/tests/overlay/014.out b/tests/overlay/014.out
new file mode 100644
index 0000000..ec09c4d
--- /dev/null
+++ b/tests/overlay/014.out
@@ -0,0 +1,3 @@
+QA output created by 014
+visibledir
+visiblefile
diff --git a/tests/overlay/group b/tests/overlay/group
index 5c80566..71eaadb 100644
--- a/tests/overlay/group
+++ b/tests/overlay/group
@@ -16,3 +16,4 @@
011 auto quick
012 auto quick
013 auto quick
+014 auto quick copyup
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] overlay: copy-up lowerdir which has opaque xattr set
2016-08-08 17:23 [PATCH] overlay: copy-up lowerdir which has opaque xattr set Eryu Guan
@ 2016-08-09 4:09 ` Xiong Zhou
2016-08-09 6:37 ` Dave Chinner
1 sibling, 0 replies; 4+ messages in thread
From: Xiong Zhou @ 2016-08-09 4:09 UTC (permalink / raw)
To: Eryu Guan; +Cc: fstests, linux-unionfs, xzhou
On Tue, Aug 09, 2016 at 01:23:53AM +0800, Eryu Guan wrote:
> When copying up a directory with opaque xattr set, the xattr was
> copied up as well, after a remount the opaque flag is honored so the
> copied-up directory is treated as opaque, which causes files created
> in the lowerdir to be hidden when using multiple lower directories.
Tested and ack.
Thanks,
Xiong
>
> This is fixed by "ovl: don't copy up opaqueness".
>
> Signed-off-by: Eryu Guan <eguan@redhat.com>
> ---
> tests/overlay/014 | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++
> tests/overlay/014.out | 3 ++
> tests/overlay/group | 1 +
> 3 files changed, 100 insertions(+)
> create mode 100755 tests/overlay/014
> create mode 100644 tests/overlay/014.out
>
> diff --git a/tests/overlay/014 b/tests/overlay/014
> new file mode 100755
> index 0000000..d9d8b5d
> --- /dev/null
> +++ b/tests/overlay/014
> @@ -0,0 +1,96 @@
> +#! /bin/bash
> +# FS QA Test 014
> +#
> +# Test copy-up of lowerdir with opaque xattr set.
> +#
> +# When copying up a directory with opaque xattr set, the xattr was copied up as
> +# well, after a remount the opaque flag is honored so the copied-up directory
> +# is treated as opaque, which causes files created in the lowerdir to be hidden
> +# when using multiple lower directories.
> +#
> +# This is fixed by "ovl: don't copy up opaqueness".
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2016 Red Hat Inc. All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
> +#-----------------------------------------------------------------------
> +#
> +
> +seq=`basename $0`
> +seqres=$RESULT_DIR/$seq
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1 # failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> + cd /
> + rm -f $tmp.*
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +. ./common/attr
> +
> +# remove previous $seqres.full before test
> +rm -f $seqres.full
> +
> +# real QA test starts here
> +_supported_fs overlay
> +_supported_os Linux
> +_require_test
> +_require_scratch
> +_require_attrs
> +
> +# Remove all files from previous tests
> +_scratch_mkfs
> +
> +# Create multiple lowerdirs and upperdir, workdir, and testdir on lowerdir
> +lowerdir1=$SCRATCH_DEV/lower1
> +lowerdir2=$SCRATCH_DEV/lower2
> +upperdir=$SCRATCH_DEV/upper
> +workdir=$SCRATCH_DEV/workdir
> +mkdir -p $lowerdir1 $lowerdir2 $upperdir $workdir
> +mkdir -p $lowerdir1/testdir/d
> +
> +# mount overlay with $lowerdir2 as upperdir, and remove & recreate testdir,
> +# make testdir on $lowerdir2 opaque
> +$MOUNT_PROG -t overlay -o lowerdir=$lowerdir1,upperdir=$lowerdir2 \
> + -o workdir=$workdir none $SCRATCH_MNT
> +rm -rf $SCRATCH_MNT/testdir
> +mkdir -p $SCRATCH_MNT/testdir/visibledir
> +$UMOUNT_PROG $SCRATCH_MNT
> +
> +# mount overlay again, with lowerdir1 and lowerdir2 as multiple lowerdirs,
> +# and create a new file in testdir, triggers copyup from lowerdir,
> +# copyup should not copy overlayfs private xattr
> +$MOUNT_PROG -t overlay -o lowerdir=$lowerdir2:$lowerdir1,upperdir=$upperdir \
> + -o workdir=$workdir none $SCRATCH_MNT
> +touch $SCRATCH_MNT/testdir/visiblefile
> +
> +# umount and mount overlay again, buggy kernel treats the copied-up dir as
> +# opaque, visibledir is not seen in merged dir.
> +$UMOUNT_PROG $SCRATCH_MNT
> +$MOUNT_PROG -t overlay -o lowerdir=$lowerdir2:$lowerdir1,upperdir=$upperdir \
> + -o workdir=$workdir none $SCRATCH_MNT
> +ls $SCRATCH_MNT/testdir
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/overlay/014.out b/tests/overlay/014.out
> new file mode 100644
> index 0000000..ec09c4d
> --- /dev/null
> +++ b/tests/overlay/014.out
> @@ -0,0 +1,3 @@
> +QA output created by 014
> +visibledir
> +visiblefile
> diff --git a/tests/overlay/group b/tests/overlay/group
> index 5c80566..71eaadb 100644
> --- a/tests/overlay/group
> +++ b/tests/overlay/group
> @@ -16,3 +16,4 @@
> 011 auto quick
> 012 auto quick
> 013 auto quick
> +014 auto quick copyup
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] overlay: copy-up lowerdir which has opaque xattr set
2016-08-08 17:23 [PATCH] overlay: copy-up lowerdir which has opaque xattr set Eryu Guan
2016-08-09 4:09 ` Xiong Zhou
@ 2016-08-09 6:37 ` Dave Chinner
2016-08-09 6:55 ` Eryu Guan
1 sibling, 1 reply; 4+ messages in thread
From: Dave Chinner @ 2016-08-09 6:37 UTC (permalink / raw)
To: Eryu Guan; +Cc: fstests, linux-unionfs, xzhou
On Tue, Aug 09, 2016 at 01:23:53AM +0800, Eryu Guan wrote:
> When copying up a directory with opaque xattr set, the xattr was
> copied up as well, after a remount the opaque flag is honored so the
> copied-up directory is treated as opaque, which causes files created
> in the lowerdir to be hidden when using multiple lower directories.
>
> This is fixed by "ovl: don't copy up opaqueness".
>
> Signed-off-by: Eryu Guan <eguan@redhat.com>
> ---
> tests/overlay/014 | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++
> tests/overlay/014.out | 3 ++
> tests/overlay/group | 1 +
> 3 files changed, 100 insertions(+)
> create mode 100755 tests/overlay/014
> create mode 100644 tests/overlay/014.out
>
> diff --git a/tests/overlay/014 b/tests/overlay/014
> new file mode 100755
> index 0000000..d9d8b5d
> --- /dev/null
> +++ b/tests/overlay/014
> @@ -0,0 +1,96 @@
> +#! /bin/bash
> +# FS QA Test 014
> +#
> +# Test copy-up of lowerdir with opaque xattr set.
> +#
> +# When copying up a directory with opaque xattr set, the xattr was copied up as
> +# well, after a remount the opaque flag is honored so the copied-up directory
> +# is treated as opaque, which causes files created in the lowerdir to be hidden
> +# when using multiple lower directories.
> +#
> +# This is fixed by "ovl: don't copy up opaqueness".
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2016 Red Hat Inc. All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
> +#-----------------------------------------------------------------------
> +#
> +
> +seq=`basename $0`
> +seqres=$RESULT_DIR/$seq
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1 # failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> + cd /
> + rm -f $tmp.*
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +. ./common/attr
> +
> +# remove previous $seqres.full before test
> +rm -f $seqres.full
> +
> +# real QA test starts here
> +_supported_fs overlay
> +_supported_os Linux
> +_require_test
> +_require_scratch
> +_require_attrs
> +
> +# Remove all files from previous tests
> +_scratch_mkfs
> +
> +# Create multiple lowerdirs and upperdir, workdir, and testdir on lowerdir
> +lowerdir1=$SCRATCH_DEV/lower1
> +lowerdir2=$SCRATCH_DEV/lower2
> +upperdir=$SCRATCH_DEV/upper
> +workdir=$SCRATCH_DEV/workdir
> +mkdir -p $lowerdir1 $lowerdir2 $upperdir $workdir
> +mkdir -p $lowerdir1/testdir/d
> +
> +# mount overlay with $lowerdir2 as upperdir, and remove & recreate testdir,
> +# make testdir on $lowerdir2 opaque
> +$MOUNT_PROG -t overlay -o lowerdir=$lowerdir1,upperdir=$lowerdir2 \
> + -o workdir=$workdir none $SCRATCH_MNT
We really need a _overlay_scratch_mount_dirs() function here. i.e.
_overlay_scratch_mount_dirs $lowerdir $upperdir $workdir
and factor the _overlay_scratch_mount/_overlay_mount code to
use a single implemention of _overlay_mount_dirs()....
> +rm -rf $SCRATCH_MNT/testdir
> +mkdir -p $SCRATCH_MNT/testdir/visibledir
> +$UMOUNT_PROG $SCRATCH_MNT
_overlay_scratch_unmount
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] overlay: copy-up lowerdir which has opaque xattr set
2016-08-09 6:37 ` Dave Chinner
@ 2016-08-09 6:55 ` Eryu Guan
0 siblings, 0 replies; 4+ messages in thread
From: Eryu Guan @ 2016-08-09 6:55 UTC (permalink / raw)
To: Dave Chinner; +Cc: fstests, linux-unionfs, xzhou
On Tue, Aug 09, 2016 at 04:37:30PM +1000, Dave Chinner wrote:
> On Tue, Aug 09, 2016 at 01:23:53AM +0800, Eryu Guan wrote:
> > When copying up a directory with opaque xattr set, the xattr was
> > copied up as well, after a remount the opaque flag is honored so the
> > copied-up directory is treated as opaque, which causes files created
> > in the lowerdir to be hidden when using multiple lower directories.
> >
> > This is fixed by "ovl: don't copy up opaqueness".
> >
> > Signed-off-by: Eryu Guan <eguan@redhat.com>
> > ---
> > tests/overlay/014 | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++
> > tests/overlay/014.out | 3 ++
> > tests/overlay/group | 1 +
> > 3 files changed, 100 insertions(+)
> > create mode 100755 tests/overlay/014
> > create mode 100644 tests/overlay/014.out
> >
> > diff --git a/tests/overlay/014 b/tests/overlay/014
> > new file mode 100755
> > index 0000000..d9d8b5d
> > --- /dev/null
> > +++ b/tests/overlay/014
> > @@ -0,0 +1,96 @@
> > +#! /bin/bash
> > +# FS QA Test 014
> > +#
> > +# Test copy-up of lowerdir with opaque xattr set.
> > +#
> > +# When copying up a directory with opaque xattr set, the xattr was copied up as
> > +# well, after a remount the opaque flag is honored so the copied-up directory
> > +# is treated as opaque, which causes files created in the lowerdir to be hidden
> > +# when using multiple lower directories.
> > +#
> > +# This is fixed by "ovl: don't copy up opaqueness".
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2016 Red Hat Inc. All Rights Reserved.
> > +#
> > +# This program is free software; you can redistribute it and/or
> > +# modify it under the terms of the GNU General Public License as
> > +# published by the Free Software Foundation.
> > +#
> > +# This program is distributed in the hope that it would be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> > +# GNU General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License
> > +# along with this program; if not, write the Free Software Foundation,
> > +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
> > +#-----------------------------------------------------------------------
> > +#
> > +
> > +seq=`basename $0`
> > +seqres=$RESULT_DIR/$seq
> > +echo "QA output created by $seq"
> > +
> > +here=`pwd`
> > +tmp=/tmp/$$
> > +status=1 # failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > + cd /
> > + rm -f $tmp.*
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +. ./common/attr
> > +
> > +# remove previous $seqres.full before test
> > +rm -f $seqres.full
> > +
> > +# real QA test starts here
> > +_supported_fs overlay
> > +_supported_os Linux
> > +_require_test
> > +_require_scratch
> > +_require_attrs
> > +
> > +# Remove all files from previous tests
> > +_scratch_mkfs
> > +
> > +# Create multiple lowerdirs and upperdir, workdir, and testdir on lowerdir
> > +lowerdir1=$SCRATCH_DEV/lower1
> > +lowerdir2=$SCRATCH_DEV/lower2
> > +upperdir=$SCRATCH_DEV/upper
> > +workdir=$SCRATCH_DEV/workdir
> > +mkdir -p $lowerdir1 $lowerdir2 $upperdir $workdir
> > +mkdir -p $lowerdir1/testdir/d
> > +
> > +# mount overlay with $lowerdir2 as upperdir, and remove & recreate testdir,
> > +# make testdir on $lowerdir2 opaque
> > +$MOUNT_PROG -t overlay -o lowerdir=$lowerdir1,upperdir=$lowerdir2 \
> > + -o workdir=$workdir none $SCRATCH_MNT
>
> We really need a _overlay_scratch_mount_dirs() function here. i.e.
>
> _overlay_scratch_mount_dirs $lowerdir $upperdir $workdir
>
> and factor the _overlay_scratch_mount/_overlay_mount code to
> use a single implemention of _overlay_mount_dirs()....
Sounds good to me. I'll see if I can write a new helper and convert
existing code to use this helper in a separate patch.
>
> > +rm -rf $SCRATCH_MNT/testdir
> > +mkdir -p $SCRATCH_MNT/testdir/visibledir
> > +$UMOUNT_PROG $SCRATCH_MNT
>
> _overlay_scratch_unmount
Okay.
Thanks for the review!
Eryu
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-08-09 6:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-08 17:23 [PATCH] overlay: copy-up lowerdir which has opaque xattr set Eryu Guan
2016-08-09 4:09 ` Xiong Zhou
2016-08-09 6:37 ` Dave Chinner
2016-08-09 6:55 ` Eryu Guan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).