All of lore.kernel.org
 help / color / mirror / Atom feed
* [xfstests v4 0/8] bunch of overlay tests
@ 2017-02-23  9:42 Xiong Zhou
  2017-02-23  9:42 ` [xfstests v4 1/8] overlay: disallow overlayfs as upperdir Xiong Zhou
                   ` (7 more replies)
  0 siblings, 8 replies; 18+ messages in thread
From: Xiong Zhou @ 2017-02-23  9:42 UTC (permalink / raw)
  To: fstests; +Cc: linux-unionfs, mszeredi, Xiong Zhou

v4:
  use --absolute-names for get/set fattr/facl
  add helper _require_and_mount_tmpfs
  mount tmpfs in TEST_DIR
  add entry for _require_command "$FLOCK_PROG" flock
  tune xattr filter case errno handling and log

v3:
  cc linux-unionfs
  rm -rf $tmp in cleanup
  checking exact errno in set/getfattr case
  sleep less in flock case

Xiong Zhou (8):
  overlay: disallow overlayfs as upperdir
  overlay: work dir in overlay inherits no ACLs
  overlay: test workdir cleanup in mounting
  overlay: permission check with cached acls in tmpfs
  overlay: filter out xattr starts with "trusted.overlay."
  overlay: can not change underlying immutable file
  overlay: test flock after copied up
  overlay: accessing stacked overlayfs files

 common/config         |   1 +
 common/rc             |  10 +++++
 tests/overlay/022     |  82 +++++++++++++++++++++++++++++++++++++
 tests/overlay/022.out |   2 +
 tests/overlay/023     |  79 ++++++++++++++++++++++++++++++++++++
 tests/overlay/023.out |   8 ++++
 tests/overlay/024     |  80 ++++++++++++++++++++++++++++++++++++
 tests/overlay/024.out |   2 +
 tests/overlay/025     |  81 +++++++++++++++++++++++++++++++++++++
 tests/overlay/025.out |   2 +
 tests/overlay/026     | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/overlay/026.out |   6 +++
 tests/overlay/027     |  87 +++++++++++++++++++++++++++++++++++++++
 tests/overlay/027.out |   2 +
 tests/overlay/028     |  81 +++++++++++++++++++++++++++++++++++++
 tests/overlay/028.out |   2 +
 tests/overlay/029     | 100 +++++++++++++++++++++++++++++++++++++++++++++
 tests/overlay/029.out |   5 +++
 tests/overlay/group   |   8 ++++
 19 files changed, 748 insertions(+)
 create mode 100755 tests/overlay/022
 create mode 100644 tests/overlay/022.out
 create mode 100755 tests/overlay/023
 create mode 100644 tests/overlay/023.out
 create mode 100755 tests/overlay/024
 create mode 100644 tests/overlay/024.out
 create mode 100755 tests/overlay/025
 create mode 100644 tests/overlay/025.out
 create mode 100755 tests/overlay/026
 create mode 100644 tests/overlay/026.out
 create mode 100755 tests/overlay/027
 create mode 100644 tests/overlay/027.out
 create mode 100755 tests/overlay/028
 create mode 100644 tests/overlay/028.out
 create mode 100755 tests/overlay/029
 create mode 100644 tests/overlay/029.out

-- 
1.8.3.1

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

* [xfstests v4 1/8] overlay: disallow overlayfs as upperdir
  2017-02-23  9:42 [xfstests v4 0/8] bunch of overlay tests Xiong Zhou
@ 2017-02-23  9:42 ` Xiong Zhou
  2017-02-23  9:42 ` [xfstests v4 2/8] overlay: work dir in overlay inherits no ACLs Xiong Zhou
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 18+ messages in thread
From: Xiong Zhou @ 2017-02-23  9:42 UTC (permalink / raw)
  To: fstests; +Cc: linux-unionfs, mszeredi, Xiong Zhou

Using overlayfs dir as upperdir to mount another
overlayfs should fail.

CC: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Xiong Zhou <xzhou@redhat.com>
---
 tests/overlay/022     | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/overlay/022.out |  2 ++
 tests/overlay/group   |  1 +
 3 files changed, 85 insertions(+)
 create mode 100755 tests/overlay/022
 create mode 100644 tests/overlay/022.out

diff --git a/tests/overlay/022 b/tests/overlay/022
new file mode 100755
index 0000000..817ee63
--- /dev/null
+++ b/tests/overlay/022
@@ -0,0 +1,82 @@
+#! /bin/bash
+# FS QA Test 022
+#
+# Regression test for kernel commit:
+#     76bc8e2 ovl: disallow overlayfs as upperdir
+#
+# This reproducer was originally written by
+#     Miklos Szeredi <mszeredi@redhat.com>
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2017 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 /
+	$UMOUNT_PROG $tmp/mnt > /dev/null 2>&1
+	rm -rf $tmp
+	rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs overlay
+_supported_os Linux
+_require_scratch
+
+# Remove all files from previous tests
+_scratch_mkfs
+
+upperdir=$SCRATCH_DEV/$OVERLAY_UPPER_DIR
+mkdir -p $upperdir/upper
+mkdir -p $upperdir/work
+# mount overlay with dirs in upper
+_scratch_mount
+
+mkdir -p $tmp/{lower,mnt}
+# mount overlay using upper from another overlay upper
+# should fail
+_overlay_mount_dirs $tmp/lower $SCRATCH_MNT/upper \
+  $SCRATCH_MNT/work overlay $tmp/mnt > /dev/null 2>&1
+if [ $? -ne 0 ] ; then
+	echo "Silence is golden"
+else
+	echo "Test Fail"
+	echo "Overlay upperdir can't be another overlay upperdir"
+fi
+
+# success, all done
+status=0
+exit
diff --git a/tests/overlay/022.out b/tests/overlay/022.out
new file mode 100644
index 0000000..394c6a7
--- /dev/null
+++ b/tests/overlay/022.out
@@ -0,0 +1,2 @@
+QA output created by 022
+Silence is golden
diff --git a/tests/overlay/group b/tests/overlay/group
index 5bcc25e..45768f5 100644
--- a/tests/overlay/group
+++ b/tests/overlay/group
@@ -24,3 +24,4 @@
 019 auto stress
 020 auto quick copyup perms
 021 auto quick copyup
+022 auto quick
-- 
1.8.3.1

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

* [xfstests v4 2/8] overlay: work dir in overlay inherits no ACLs
  2017-02-23  9:42 [xfstests v4 0/8] bunch of overlay tests Xiong Zhou
  2017-02-23  9:42 ` [xfstests v4 1/8] overlay: disallow overlayfs as upperdir Xiong Zhou
@ 2017-02-23  9:42 ` Xiong Zhou
  2017-02-23 10:44   ` Eryu Guan
  2017-02-23  9:42 ` [xfstests v4 3/8] overlay: test workdir cleanup in mounting Xiong Zhou
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 18+ messages in thread
From: Xiong Zhou @ 2017-02-23  9:42 UTC (permalink / raw)
  To: fstests; +Cc: linux-unionfs, mszeredi, Xiong Zhou

They should be cleaned while mounting overlayfs.

CC: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Xiong Zhou <xzhou@redhat.com>
---
 tests/overlay/023     | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/overlay/023.out |  8 ++++++
 tests/overlay/group   |  1 +
 3 files changed, 88 insertions(+)
 create mode 100755 tests/overlay/023
 create mode 100644 tests/overlay/023.out

diff --git a/tests/overlay/023 b/tests/overlay/023
new file mode 100755
index 0000000..0d0da93
--- /dev/null
+++ b/tests/overlay/023
@@ -0,0 +1,79 @@
+#! /bin/bash
+# FS QA Test 023
+#
+# The "work" directory in an overlyfs workdir should not inherit
+# ACL attrs from workdir.
+# Kernel commits below fix it.
+#   c11b9fdd6a61 ovl: remove posix_acl_default from workdir
+#   e1ff3dd1ae52 ovl: fix workdir creation
+#
+# This reproducer was originally written by
+#     Miklos Szeredi <mszeredi@redhat.com>
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2017 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
+
+# Modify as appropriate.
+_supported_fs overlay
+_supported_os Linux
+_require_acls
+_require_scratch
+
+# Remove all files from previous tests
+_scratch_mkfs
+
+# setting acls before mount
+wkdir=$SCRATCH_DEV/$OVERLAY_WORK_DIR
+mkdir -p $wkdir
+setfacl -d -m o::rwx $wkdir
+
+_scratch_mount
+
+# getting acls and doing a non-common filter,
+# since getfacl will remove leading / from absolute
+# path names.
+getfacl -p $wkdir/work 2>&1 | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/overlay/023.out b/tests/overlay/023.out
new file mode 100644
index 0000000..a1a3c37
--- /dev/null
+++ b/tests/overlay/023.out
@@ -0,0 +1,8 @@
+QA output created by 023
+# file: SCRATCH_DEV/work/work
+# owner: root
+# group: root
+user::---
+group::---
+other::---
+
diff --git a/tests/overlay/group b/tests/overlay/group
index 45768f5..09da1be 100644
--- a/tests/overlay/group
+++ b/tests/overlay/group
@@ -25,3 +25,4 @@
 020 auto quick copyup perms
 021 auto quick copyup
 022 auto quick
+023 auto quick attr
-- 
1.8.3.1

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

* [xfstests v4 3/8] overlay: test workdir cleanup in mounting
  2017-02-23  9:42 [xfstests v4 0/8] bunch of overlay tests Xiong Zhou
  2017-02-23  9:42 ` [xfstests v4 1/8] overlay: disallow overlayfs as upperdir Xiong Zhou
  2017-02-23  9:42 ` [xfstests v4 2/8] overlay: work dir in overlay inherits no ACLs Xiong Zhou
@ 2017-02-23  9:42 ` Xiong Zhou
  2017-02-23  9:42 ` [xfstests v4 4/8] overlay: permission check with cached acls in tmpfs Xiong Zhou
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 18+ messages in thread
From: Xiong Zhou @ 2017-02-23  9:42 UTC (permalink / raw)
  To: fstests; +Cc: linux-unionfs, mszeredi, Xiong Zhou

"work" directory in workdir should be cleaned up
and recreated while overlayfs mounting. Or overlayfs
will be mounted read-only.

CC: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Xiong Zhou <xzhou@redhat.com>
---
 tests/overlay/024     | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/overlay/024.out |  2 ++
 tests/overlay/group   |  1 +
 3 files changed, 83 insertions(+)
 create mode 100755 tests/overlay/024
 create mode 100644 tests/overlay/024.out

diff --git a/tests/overlay/024 b/tests/overlay/024
new file mode 100755
index 0000000..2dbef12
--- /dev/null
+++ b/tests/overlay/024
@@ -0,0 +1,80 @@
+#! /bin/bash
+# FS QA Test 024
+#
+# "work" directory under workdir should be cleaned up
+# well on overlayfs startup, or overlayfs will be mounted
+# read-only.
+# Kernel commit below fixes it.
+# eea2fb4851e9 ovl: proper cleanup of workdir
+#
+# This reproducer was originally written by
+#     Miklos Szeredi <mszeredi@redhat.com>
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2017 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
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs overlay
+_supported_os Linux
+_require_scratch
+
+# Remove all files from previous tests
+_scratch_mkfs
+
+# making workdir
+wkdir=$SCRATCH_DEV/$OVERLAY_WORK_DIR
+mkdir -p $wkdir/work/foo
+
+_scratch_mount
+
+# try writing to mountpoint
+touch $SCRATCH_MNT/bar
+
+# checking work dir is clean
+if [ -e $wkdir/work/foo ] ; then
+	echo "work dir is not clean"
+else
+	echo "Silence is golden"
+fi
+# success, all done
+status=0
+exit
diff --git a/tests/overlay/024.out b/tests/overlay/024.out
new file mode 100644
index 0000000..fd6fbb1
--- /dev/null
+++ b/tests/overlay/024.out
@@ -0,0 +1,2 @@
+QA output created by 024
+Silence is golden
diff --git a/tests/overlay/group b/tests/overlay/group
index 09da1be..0563a04 100644
--- a/tests/overlay/group
+++ b/tests/overlay/group
@@ -26,3 +26,4 @@
 021 auto quick copyup
 022 auto quick
 023 auto quick attr
+024 auto quick
-- 
1.8.3.1

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

* [xfstests v4 4/8] overlay: permission check with cached acls in tmpfs
  2017-02-23  9:42 [xfstests v4 0/8] bunch of overlay tests Xiong Zhou
                   ` (2 preceding siblings ...)
  2017-02-23  9:42 ` [xfstests v4 3/8] overlay: test workdir cleanup in mounting Xiong Zhou
@ 2017-02-23  9:42 ` Xiong Zhou
  2017-02-23 10:52   ` Eryu Guan
  2017-02-23  9:42 ` [xfstests v4 5/8] overlay: filter out xattr starts with "trusted.overlay." Xiong Zhou
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 18+ messages in thread
From: Xiong Zhou @ 2017-02-23  9:42 UTC (permalink / raw)
  To: fstests; +Cc: linux-unionfs, mszeredi, Xiong Zhou

tmpfs does not implement ->get_acl method, overlayfs
need to get its cached acls in permission check when
lower or upper fs is tmpfs.

CC: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Xiong Zhou <xzhou@redhat.com>
---
 common/rc             | 10 +++++++
 tests/overlay/025     | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/overlay/025.out |  2 ++
 tests/overlay/group   |  1 +
 4 files changed, 94 insertions(+)
 create mode 100755 tests/overlay/025
 create mode 100644 tests/overlay/025.out

diff --git a/common/rc b/common/rc
index ec59b88..b58f7c6 100644
--- a/common/rc
+++ b/common/rc
@@ -3297,6 +3297,16 @@ _get_fs_sysfs_attr()
 }
 
 
+# Attempt to mount tmpfs at given directory in $1.
+#
+# Example:
+# _require_and_mount_tmpfs $tmpdir
+#
+_require_and_mount_tmpfs()
+{
+	$MOUNT_PROG -t tmpfs tmpfs $1 || \
+		_notrun "this test requires valid tmpfs"
+}
 
 init_rc
 
diff --git a/tests/overlay/025 b/tests/overlay/025
new file mode 100755
index 0000000..3c9f843
--- /dev/null
+++ b/tests/overlay/025
@@ -0,0 +1,81 @@
+#! /bin/bash
+# FS QA Test 025
+#
+# Overlayfs failed to get posix acls if lower or upper
+# fs is tmpfs.
+# Kernel commit below fixed it.
+# 5201dc449e4b ovl: use cached acl on underlying layer
+#
+# This reproducer was originally written by
+#     Miklos Szeredi <mszeredi@redhat.com>
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2017 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 /
+	$UMOUNT_PROG $tmpfsdir/mnt
+	$UMOUNT_PROG $tmpfsdir
+	rm -rf $tmpfsdir
+	rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs overlay
+_supported_os Linux
+_require_user
+
+# create a tmpfs in $TEST_DIR
+tmpfsdir=$TEST_DIR/tmpfs
+mkdir -p $tmpfsdir
+_require_and_mount_tmpfs $tmpfsdir
+
+mkdir -p $tmpfsdir/{lower,upper,work,mnt}
+mkdir -p -m 0 $tmpfsdir/upper/testd
+# grant permission for $qa_user
+setfacl -m u:$qa_user:rx $tmpfsdir/upper/testd
+
+# mount overlay using dirs in tmpfs
+_overlay_mount_dirs $tmpfsdir/{lower,upper,work,overlay,mnt}
+
+# user accessing test dir, should be OKay
+_user_do "ls $tmpfsdir/mnt/testd"
+
+echo "Silence is golden"
+# success, all done
+status=0
+exit
diff --git a/tests/overlay/025.out b/tests/overlay/025.out
new file mode 100644
index 0000000..3d70951
--- /dev/null
+++ b/tests/overlay/025.out
@@ -0,0 +1,2 @@
+QA output created by 025
+Silence is golden
diff --git a/tests/overlay/group b/tests/overlay/group
index 0563a04..82fe69e 100644
--- a/tests/overlay/group
+++ b/tests/overlay/group
@@ -27,3 +27,4 @@
 022 auto quick
 023 auto quick attr
 024 auto quick
+025 auto quick attr
-- 
1.8.3.1

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

* [xfstests v4 5/8] overlay: filter out xattr starts with "trusted.overlay."
  2017-02-23  9:42 [xfstests v4 0/8] bunch of overlay tests Xiong Zhou
                   ` (3 preceding siblings ...)
  2017-02-23  9:42 ` [xfstests v4 4/8] overlay: permission check with cached acls in tmpfs Xiong Zhou
@ 2017-02-23  9:42 ` Xiong Zhou
  2017-02-23  9:42 ` [xfstests v4 6/8] overlay: can not change underlying immutable file Xiong Zhou
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 18+ messages in thread
From: Xiong Zhou @ 2017-02-23  9:42 UTC (permalink / raw)
  To: fstests; +Cc: linux-unionfs, mszeredi, Xiong Zhou

Overlayfs should only filter out xattr starting with
"trusted.overlay.", not "trusted.overlay".

Setting xattrs like "trusted.overlay.xxx" is not allowed.
Setting xattrs like "trusted.overlayxxx" is allowed.

v4.8-rc1 introduced a regression that we can't set xattrs
like "trusted.overlayxxx".  Kernel commit below fixed it
in v4.8:
  fe2b75952347 ovl: Fix OVL_XATTR_PREFIX

This case tests both get/set of these 2 kinds of xattrs.

Pattern "trusted.overlay.xxx" should fail, however the
errno returned by set/get varies among kernel versions.

Pattern "trusted.overlayxxx" shold always work.

CC: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Xiong Zhou <xzhou@redhat.com>
---
 tests/overlay/026     | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/overlay/026.out |   6 +++
 tests/overlay/group   |   1 +
 3 files changed, 117 insertions(+)
 create mode 100755 tests/overlay/026
 create mode 100644 tests/overlay/026.out

diff --git a/tests/overlay/026 b/tests/overlay/026
new file mode 100755
index 0000000..55adbad
--- /dev/null
+++ b/tests/overlay/026
@@ -0,0 +1,110 @@
+#! /bin/bash
+# FS QA Test 026
+#
+# Overlayfs should only filter out xattr starting with
+# "trusted.overlay.", not "trusted.overlay".
+#
+# Setting xattrs like "trusted.overlay.xxx" is not allowed.
+# Setting xattrs like "trusted.overlayxxx" is allowed.
+#
+# v4.8-rc1 introduced a regression that we can't set xattrs
+# like "trusted.overlayxxx".  Kernel commit below fixed it
+# in v4.8:
+#   fe2b75952347 ovl: Fix OVL_XATTR_PREFIX
+#
+# This case tests both get/set of these 2 kinds of xattrs.
+#
+# Pattern "trusted.overlay.xxx" should fail, however the
+# errno returned by set/get varies among kernel versions.
+# Pattern "trusted.overlayxxx" shold always work.
+#
+# This reproducer was originally written by
+#     Miklos Szeredi <mszeredi@redhat.com>
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2017 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/attr
+. ./common/filter
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs overlay
+_supported_os Linux
+_require_scratch
+_require_attrs
+
+# Remove all files from previous tests
+_scratch_mkfs
+
+# Mounting overlay
+_scratch_mount
+touch $SCRATCH_MNT/testf0
+touch $SCRATCH_MNT/testf1
+
+# {s,g}etfattr of "trusted.overlayxxx" should work.
+#            v4.3/6/7    v4.8-rc1   v4.8  v4.10
+# setfattr    ok         not perm    ok    ok
+# getfattr    ok         no attr     ok    ok
+#
+$SETFATTR_PROG -n "trusted.overlayfsrz" -v "n" \
+  $SCRATCH_MNT/testf0 2>&1 | _filter_scratch
+
+$GETFATTR_PROG --absolute-names -n "trusted.overlayfsrz" \
+  $SCRATCH_MNT/testf0 2>&1 | _filter_scratch
+
+# {s,g}etfattr of "trusted.overlay.xxx" should fail.
+# The errno returned varies among kernel versions,
+#            v4.3/7   v4.8-rc1    v4.8       v4.10
+# setfattr  not perm  not perm   not perm   not supp
+# getfattr  no attr   no attr    not perm   not supp
+#
+# Consider "Operation not {supported,permitted}" pass.
+#
+$SETFATTR_PROG -n "trusted.overlay.fsz" -v "n" \
+  $SCRATCH_MNT/testf1 2>&1 | _filter_scratch | \
+  sed -e 's/permitted/supported/g'
+
+$GETFATTR_PROG --absolute-names -n "trusted.overlay.fsz" \
+  $SCRATCH_MNT/testf1 2>&1 | _filter_scratch | \
+  sed -e 's/permitted/supported/g'
+
+# success, all done
+status=0
+exit
diff --git a/tests/overlay/026.out b/tests/overlay/026.out
new file mode 100644
index 0000000..c4572d6
--- /dev/null
+++ b/tests/overlay/026.out
@@ -0,0 +1,6 @@
+QA output created by 026
+# file: SCRATCH_MNT/testf0
+trusted.overlayfsrz="n"
+
+setfattr: SCRATCH_MNT/testf1: Operation not supported
+SCRATCH_MNT/testf1: trusted.overlay.fsz: Operation not supported
diff --git a/tests/overlay/group b/tests/overlay/group
index 82fe69e..92afa8d 100644
--- a/tests/overlay/group
+++ b/tests/overlay/group
@@ -28,3 +28,4 @@
 023 auto quick attr
 024 auto quick
 025 auto quick attr
+026 auto attr quick
-- 
1.8.3.1

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

* [xfstests v4 6/8] overlay: can not change underlying immutable file
  2017-02-23  9:42 [xfstests v4 0/8] bunch of overlay tests Xiong Zhou
                   ` (4 preceding siblings ...)
  2017-02-23  9:42 ` [xfstests v4 5/8] overlay: filter out xattr starts with "trusted.overlay." Xiong Zhou
@ 2017-02-23  9:42 ` Xiong Zhou
  2017-04-04 11:19   ` Amir Goldstein
  2017-02-23  9:42 ` [xfstests v4 7/8] overlay: test flock after copied up Xiong Zhou
  2017-02-23  9:42 ` [xfstests v4 8/8] overlay: accessing stacked overlayfs files Xiong Zhou
  7 siblings, 1 reply; 18+ messages in thread
From: Xiong Zhou @ 2017-02-23  9:42 UTC (permalink / raw)
  To: fstests; +Cc: linux-unionfs, mszeredi, Xiong Zhou

Even timestamp change by touch.

CC: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Xiong Zhou <xzhou@redhat.com>
---
 tests/overlay/027     | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/overlay/027.out |  2 ++
 tests/overlay/group   |  1 +
 3 files changed, 90 insertions(+)
 create mode 100755 tests/overlay/027
 create mode 100644 tests/overlay/027.out

diff --git a/tests/overlay/027 b/tests/overlay/027
new file mode 100755
index 0000000..4bb0329
--- /dev/null
+++ b/tests/overlay/027
@@ -0,0 +1,87 @@
+#! /bin/bash
+# FS QA Test 027
+#
+# If underlying upper file is immutable, it should stays
+# untouchable in the overlayfs mount.
+#
+# Kernel commit below fixed it.
+# f2b20f6ee842 vfs: move permission checking into ...
+#
+# This reproducer was originally written by
+#     Miklos Szeredi <mszeredi@redhat.com>
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2017 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 /
+	$CHATTR_PROG -i $upperdir/foo
+	rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs overlay
+_supported_os Linux
+_require_scratch
+_require_chattr
+
+# Remove all files from previous tests
+_scratch_mkfs
+
+# Preparing immutable file
+upperdir=$SCRATCH_DEV/$OVERLAY_UPPER_DIR
+mkdir -p $upperdir
+touch $upperdir/foo
+$CHATTR_PROG +i $upperdir/foo
+
+# Mounting overlay
+_scratch_mount
+
+# Touching immutable file in overlay, should fail.
+# Not filtering output here because of errno returned
+# varies among kernel versions:
+#   touch: setting times of 'foo': Operation not permitted
+#   touch: cannot touch 'foo': Permission denied
+if touch $SCRATCH_MNT/foo > /dev/null 2>&1 ; then
+	echo "Test Fail, you can't change an immutable file"
+else
+	echo "Silence is golden"
+fi
+
+# success, all done
+status=0
+exit
diff --git a/tests/overlay/027.out b/tests/overlay/027.out
new file mode 100644
index 0000000..ef78cda
--- /dev/null
+++ b/tests/overlay/027.out
@@ -0,0 +1,2 @@
+QA output created by 027
+Silence is golden
diff --git a/tests/overlay/group b/tests/overlay/group
index 92afa8d..4db6751 100644
--- a/tests/overlay/group
+++ b/tests/overlay/group
@@ -29,3 +29,4 @@
 024 auto quick
 025 auto quick attr
 026 auto attr quick
+027 auto quick perms
-- 
1.8.3.1

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

* [xfstests v4 7/8] overlay: test flock after copied up
  2017-02-23  9:42 [xfstests v4 0/8] bunch of overlay tests Xiong Zhou
                   ` (5 preceding siblings ...)
  2017-02-23  9:42 ` [xfstests v4 6/8] overlay: can not change underlying immutable file Xiong Zhou
@ 2017-02-23  9:42 ` Xiong Zhou
  2017-02-23  9:42 ` [xfstests v4 8/8] overlay: accessing stacked overlayfs files Xiong Zhou
  7 siblings, 0 replies; 18+ messages in thread
From: Xiong Zhou @ 2017-02-23  9:42 UTC (permalink / raw)
  To: fstests; +Cc: linux-unionfs, mszeredi, Xiong Zhou

Locks of file in lower dir should working after it's
been copied up.

CC: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Xiong Zhou <xzhou@redhat.com>
---
 common/config         |  1 +
 tests/overlay/028     | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/overlay/028.out |  2 ++
 tests/overlay/group   |  1 +
 4 files changed, 85 insertions(+)
 create mode 100755 tests/overlay/028
 create mode 100644 tests/overlay/028.out

diff --git a/common/config b/common/config
index fa89f42..3ef401b 100644
--- a/common/config
+++ b/common/config
@@ -204,6 +204,7 @@ export GETRICHACL_PROG="`set_prog_path getrichacl`"
 export SETRICHACL_PROG="`set_prog_path setrichacl`"
 export KEYCTL_PROG="`set_prog_path keyctl`"
 export XZ_PROG="`set_prog_path xz`"
+export FLOCK_PROG="`set_prog_path flock`"
 
 # use 'udevadm settle' or 'udevsettle' to wait for lv to be settled.
 # newer systems have udevadm command but older systems like RHEL5 don't.
diff --git a/tests/overlay/028 b/tests/overlay/028
new file mode 100755
index 0000000..6045e09
--- /dev/null
+++ b/tests/overlay/028
@@ -0,0 +1,81 @@
+#! /bin/bash
+# FS QA Test 028
+#
+# When file in lower dir is locked and it's been copied up,
+# make sure the lock is working in overlayfs.
+#
+# Kernel commit below fixed it.
+# c568d68341be locks: fix file locking on overlayfs
+#
+# This reproducer was originally written by
+#     Miklos Szeredi <mszeredi@redhat.com>
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2017 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
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs overlay
+_supported_os Linux
+_require_scratch
+_require_command "$FLOCK_PROG" flock
+
+# Remove all files from previous tests
+_scratch_mkfs
+
+lowerdir=$SCRATCH_DEV/$OVERLAY_LOWER_DIR
+mkdir -p $lowerdir
+touch $lowerdir/foo
+
+# Mounting overlay
+_scratch_mount
+
+# Testing copyup and flock
+flock $SCRATCH_MNT/foo sleep 3 &
+# flock in subshell should fail with no output
+(sleep 1; echo bar > $SCRATCH_MNT/foo; \
+  flock -n $SCRATCH_MNT/foo echo LOCKED)
+
+wait
+echo "Silence is golden"
+# success, all done
+status=0
+exit
diff --git a/tests/overlay/028.out b/tests/overlay/028.out
new file mode 100644
index 0000000..2615f73
--- /dev/null
+++ b/tests/overlay/028.out
@@ -0,0 +1,2 @@
+QA output created by 028
+Silence is golden
diff --git a/tests/overlay/group b/tests/overlay/group
index 4db6751..cf058fc 100644
--- a/tests/overlay/group
+++ b/tests/overlay/group
@@ -30,3 +30,4 @@
 025 auto quick attr
 026 auto attr quick
 027 auto quick perms
+028 auto copyup quick
-- 
1.8.3.1

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

* [xfstests v4 8/8] overlay: accessing stacked overlayfs files
  2017-02-23  9:42 [xfstests v4 0/8] bunch of overlay tests Xiong Zhou
                   ` (6 preceding siblings ...)
  2017-02-23  9:42 ` [xfstests v4 7/8] overlay: test flock after copied up Xiong Zhou
@ 2017-02-23  9:42 ` Xiong Zhou
  2017-03-03  8:19   ` Amir Goldstein
  7 siblings, 1 reply; 18+ messages in thread
From: Xiong Zhou @ 2017-02-23  9:42 UTC (permalink / raw)
  To: fstests; +Cc: linux-unionfs, mszeredi, Xiong Zhou

Lower dir comes from another overlayfs dir, then
accessing files in it should work.

CC: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Xiong Zhou <xzhou@redhat.com>
---
 tests/overlay/029     | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/overlay/029.out |   5 +++
 tests/overlay/group   |   1 +
 3 files changed, 106 insertions(+)
 create mode 100755 tests/overlay/029
 create mode 100644 tests/overlay/029.out

diff --git a/tests/overlay/029 b/tests/overlay/029
new file mode 100755
index 0000000..902a84c
--- /dev/null
+++ b/tests/overlay/029
@@ -0,0 +1,100 @@
+#! /bin/bash
+# FS QA Test 029
+#
+# There are dirs/files in lower dir and upper dir before
+# mounting overlayfs. After mounting, use dir in overlayfs
+# mountpoint as lowerdir to mount another overlayfs, then
+# access old files through the second overlayfs. It was
+# not working, kernel commit below fixed it.
+#
+# c4fcfc1619ea ovl: fix d_real() for stacked fs
+#
+# This reproducer was originally written by
+#     Miklos Szeredi <mszeredi@redhat.com>
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2017 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 /
+	$UMOUNT_PROG $tmp/mnt
+	rm -rf $tmp
+	rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs overlay
+_supported_os Linux
+_require_scratch
+
+# Remove all files from previous tests
+_scratch_mkfs
+
+# Preparing files
+upperdir=$SCRATCH_DEV/$OVERLAY_UPPER_DIR
+lowerdir=$SCRATCH_DEV/$OVERLAY_LOWER_DIR
+mkdir -p $upperdir/up
+echo foo > $upperdir/up/foo
+mkdir -p $lowerdir/low
+echo bar > $lowerdir/low/bar
+
+# mount overlay in SCRATCH_MNT
+_scratch_mount
+
+mkdir -p $tmp/{upper,mnt,work}
+# mount overlay again using upper dir from SCRATCH_MNT dir
+_overlay_mount_dirs $SCRATCH_MNT/up $tmp/{upper,work} \
+  overlay $tmp/mnt
+# accessing file in the second mount
+cat $tmp/mnt/foo
+$UMOUNT_PROG $tmp/mnt
+
+# mount overlay again using lower dir from SCRATCH_MNT dir
+_overlay_mount_dirs $SCRATCH_MNT/low $tmp/{upper,work} \
+  overlay $tmp/mnt
+cat $tmp/mnt/bar
+$UMOUNT_PROG $tmp/mnt
+
+# mount overlay again using SCRATCH_MNT dir
+_overlay_mount_dirs $SCRATCH_MNT/ $tmp/{upper,work} \
+  overlay $tmp/mnt
+cat $tmp/mnt/up/foo
+cat $tmp/mnt/low/bar
+
+# success, all done
+status=0
+exit
diff --git a/tests/overlay/029.out b/tests/overlay/029.out
new file mode 100644
index 0000000..e7f192c
--- /dev/null
+++ b/tests/overlay/029.out
@@ -0,0 +1,5 @@
+QA output created by 029
+foo
+bar
+foo
+bar
diff --git a/tests/overlay/group b/tests/overlay/group
index cf058fc..7e72a30 100644
--- a/tests/overlay/group
+++ b/tests/overlay/group
@@ -31,3 +31,4 @@
 026 auto attr quick
 027 auto quick perms
 028 auto copyup quick
+029 auto quick
-- 
1.8.3.1

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

* Re: [xfstests v4 2/8] overlay: work dir in overlay inherits no ACLs
  2017-02-23  9:42 ` [xfstests v4 2/8] overlay: work dir in overlay inherits no ACLs Xiong Zhou
@ 2017-02-23 10:44   ` Eryu Guan
  0 siblings, 0 replies; 18+ messages in thread
From: Eryu Guan @ 2017-02-23 10:44 UTC (permalink / raw)
  To: Xiong Zhou; +Cc: fstests, linux-unionfs, mszeredi

On Thu, Feb 23, 2017 at 05:42:40PM +0800, Xiong Zhou wrote:
> They should be cleaned while mounting overlayfs.
> 
> CC: Miklos Szeredi <mszeredi@redhat.com>
> Signed-off-by: Xiong Zhou <xzhou@redhat.com>
> ---
>  tests/overlay/023     | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/overlay/023.out |  8 ++++++
>  tests/overlay/group   |  1 +
>  3 files changed, 88 insertions(+)
>  create mode 100755 tests/overlay/023
>  create mode 100644 tests/overlay/023.out
> 
> diff --git a/tests/overlay/023 b/tests/overlay/023
> new file mode 100755
> index 0000000..0d0da93
> --- /dev/null
> +++ b/tests/overlay/023
> @@ -0,0 +1,79 @@
> +#! /bin/bash
> +# FS QA Test 023
> +#
> +# The "work" directory in an overlyfs workdir should not inherit
> +# ACL attrs from workdir.
> +# Kernel commits below fix it.
> +#   c11b9fdd6a61 ovl: remove posix_acl_default from workdir
> +#   e1ff3dd1ae52 ovl: fix workdir creation
> +#
> +# This reproducer was originally written by
> +#     Miklos Szeredi <mszeredi@redhat.com>
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2017 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
> +
> +# Modify as appropriate.
> +_supported_fs overlay
> +_supported_os Linux
> +_require_acls
> +_require_scratch
> +
> +# Remove all files from previous tests
> +_scratch_mkfs
> +
> +# setting acls before mount
> +wkdir=$SCRATCH_DEV/$OVERLAY_WORK_DIR
> +mkdir -p $wkdir
> +setfacl -d -m o::rwx $wkdir
> +
> +_scratch_mount
> +
> +# getting acls and doing a non-common filter,
> +# since getfacl will remove leading / from absolute
> +# path names.

This comment is not needed anymore. I can fix it at commit time.

Thanks,
Eryu

> +getfacl -p $wkdir/work 2>&1 | _filter_scratch
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/overlay/023.out b/tests/overlay/023.out
> new file mode 100644
> index 0000000..a1a3c37
> --- /dev/null
> +++ b/tests/overlay/023.out
> @@ -0,0 +1,8 @@
> +QA output created by 023
> +# file: SCRATCH_DEV/work/work
> +# owner: root
> +# group: root
> +user::---
> +group::---
> +other::---
> +
> diff --git a/tests/overlay/group b/tests/overlay/group
> index 45768f5..09da1be 100644
> --- a/tests/overlay/group
> +++ b/tests/overlay/group
> @@ -25,3 +25,4 @@
>  020 auto quick copyup perms
>  021 auto quick copyup
>  022 auto quick
> +023 auto quick attr
> -- 
> 1.8.3.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [xfstests v4 4/8] overlay: permission check with cached acls in tmpfs
  2017-02-23  9:42 ` [xfstests v4 4/8] overlay: permission check with cached acls in tmpfs Xiong Zhou
@ 2017-02-23 10:52   ` Eryu Guan
  2017-02-23 12:49     ` Xiong Zhou
  0 siblings, 1 reply; 18+ messages in thread
From: Eryu Guan @ 2017-02-23 10:52 UTC (permalink / raw)
  To: Xiong Zhou; +Cc: fstests, linux-unionfs, mszeredi

On Thu, Feb 23, 2017 at 05:42:42PM +0800, Xiong Zhou wrote:
> tmpfs does not implement ->get_acl method, overlayfs
> need to get its cached acls in permission check when
> lower or upper fs is tmpfs.
> 
> CC: Miklos Szeredi <mszeredi@redhat.com>
> Signed-off-by: Xiong Zhou <xzhou@redhat.com>
> ---
>  common/rc             | 10 +++++++
>  tests/overlay/025     | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/overlay/025.out |  2 ++
>  tests/overlay/group   |  1 +
>  4 files changed, 94 insertions(+)
>  create mode 100755 tests/overlay/025
>  create mode 100644 tests/overlay/025.out
> 
> diff --git a/common/rc b/common/rc
> index ec59b88..b58f7c6 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -3297,6 +3297,16 @@ _get_fs_sysfs_attr()
>  }
>  
>  
> +# Attempt to mount tmpfs at given directory in $1.
> +#
> +# Example:
> +# _require_and_mount_tmpfs $tmpdir
> +#
> +_require_and_mount_tmpfs()
> +{
> +	$MOUNT_PROG -t tmpfs tmpfs $1 || \
> +		_notrun "this test requires valid tmpfs"
> +}

We don't mix a _require rule with doing a specific operation. And we can
follow the way in _require_ext2, e.g.

# this test requires tmpfs filesystem support
#
_require_tmpfs()
{
	modprobe tmpfs >/dev/null 2>&1
	grep -q tmpfs /proc/filesystems ||
		_notrun "this test requires tmpfs support"
}

>  
>  init_rc
>  
> diff --git a/tests/overlay/025 b/tests/overlay/025
> new file mode 100755
> index 0000000..3c9f843
> --- /dev/null
> +++ b/tests/overlay/025
> @@ -0,0 +1,81 @@
> +#! /bin/bash
> +# FS QA Test 025
> +#
> +# Overlayfs failed to get posix acls if lower or upper
> +# fs is tmpfs.
> +# Kernel commit below fixed it.
> +# 5201dc449e4b ovl: use cached acl on underlying layer
> +#
> +# This reproducer was originally written by
> +#     Miklos Szeredi <mszeredi@redhat.com>
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2017 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 /
> +	$UMOUNT_PROG $tmpfsdir/mnt
> +	$UMOUNT_PROG $tmpfsdir
> +	rm -rf $tmpfsdir
> +	rm -f $tmp.*
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# remove previous $seqres.full before test
> +rm -f $seqres.full
> +
> +# real QA test starts here
> +
> +# Modify as appropriate.
> +_supported_fs overlay
> +_supported_os Linux
> +_require_user

_require_tmpfs

> +
> +# create a tmpfs in $TEST_DIR
> +tmpfsdir=$TEST_DIR/tmpfs
> +mkdir -p $tmpfsdir
> +_require_and_mount_tmpfs $tmpfsdir

then this simply becomes

$MOUNT_PROG -t tmpfs tmpfs $tmpfsdir

If all these look sane to you, I can do this straightforward update at
commit time.

Thanks,
Eryu

> +
> +mkdir -p $tmpfsdir/{lower,upper,work,mnt}
> +mkdir -p -m 0 $tmpfsdir/upper/testd
> +# grant permission for $qa_user
> +setfacl -m u:$qa_user:rx $tmpfsdir/upper/testd
> +
> +# mount overlay using dirs in tmpfs
> +_overlay_mount_dirs $tmpfsdir/{lower,upper,work,overlay,mnt}
> +
> +# user accessing test dir, should be OKay
> +_user_do "ls $tmpfsdir/mnt/testd"
> +
> +echo "Silence is golden"
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/overlay/025.out b/tests/overlay/025.out
> new file mode 100644
> index 0000000..3d70951
> --- /dev/null
> +++ b/tests/overlay/025.out
> @@ -0,0 +1,2 @@
> +QA output created by 025
> +Silence is golden
> diff --git a/tests/overlay/group b/tests/overlay/group
> index 0563a04..82fe69e 100644
> --- a/tests/overlay/group
> +++ b/tests/overlay/group
> @@ -27,3 +27,4 @@
>  022 auto quick
>  023 auto quick attr
>  024 auto quick
> +025 auto quick attr
> -- 
> 1.8.3.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [xfstests v4 4/8] overlay: permission check with cached acls in tmpfs
  2017-02-23 10:52   ` Eryu Guan
@ 2017-02-23 12:49     ` Xiong Zhou
  0 siblings, 0 replies; 18+ messages in thread
From: Xiong Zhou @ 2017-02-23 12:49 UTC (permalink / raw)
  To: Eryu Guan; +Cc: Xiong Zhou, fstests, linux-unionfs, mszeredi

On Thu, Feb 23, 2017 at 06:52:56PM +0800, Eryu Guan wrote:
> On Thu, Feb 23, 2017 at 05:42:42PM +0800, Xiong Zhou wrote:
> > tmpfs does not implement ->get_acl method, overlayfs
> > need to get its cached acls in permission check when
> > lower or upper fs is tmpfs.
> > 
> > CC: Miklos Szeredi <mszeredi@redhat.com>
> > Signed-off-by: Xiong Zhou <xzhou@redhat.com>
> > ---
> >  common/rc             | 10 +++++++
> >  tests/overlay/025     | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/overlay/025.out |  2 ++
> >  tests/overlay/group   |  1 +
> >  4 files changed, 94 insertions(+)
> >  create mode 100755 tests/overlay/025
> >  create mode 100644 tests/overlay/025.out
> > 
> > diff --git a/common/rc b/common/rc
> > index ec59b88..b58f7c6 100644
> > --- a/common/rc
> > +++ b/common/rc
> > @@ -3297,6 +3297,16 @@ _get_fs_sysfs_attr()
> >  }
> >  
> >  
> > +# Attempt to mount tmpfs at given directory in $1.
> > +#
> > +# Example:
> > +# _require_and_mount_tmpfs $tmpdir
> > +#
> > +_require_and_mount_tmpfs()
> > +{
> > +	$MOUNT_PROG -t tmpfs tmpfs $1 || \
> > +		_notrun "this test requires valid tmpfs"
> > +}
> 
> We don't mix a _require rule with doing a specific operation. And we can
> follow the way in _require_ext2, e.g.
> 
> # this test requires tmpfs filesystem support
> #
> _require_tmpfs()
> {
> 	modprobe tmpfs >/dev/null 2>&1
> 	grep -q tmpfs /proc/filesystems ||
> 		_notrun "this test requires tmpfs support"
> }
> 
> >  
> >  init_rc
> >  
> > diff --git a/tests/overlay/025 b/tests/overlay/025
> > new file mode 100755
> > index 0000000..3c9f843
> > --- /dev/null
> > +++ b/tests/overlay/025
> > @@ -0,0 +1,81 @@
> > +#! /bin/bash
> > +# FS QA Test 025
> > +#
> > +# Overlayfs failed to get posix acls if lower or upper
> > +# fs is tmpfs.
> > +# Kernel commit below fixed it.
> > +# 5201dc449e4b ovl: use cached acl on underlying layer
> > +#
> > +# This reproducer was originally written by
> > +#     Miklos Szeredi <mszeredi@redhat.com>
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2017 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 /
> > +	$UMOUNT_PROG $tmpfsdir/mnt
> > +	$UMOUNT_PROG $tmpfsdir
> > +	rm -rf $tmpfsdir
> > +	rm -f $tmp.*
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +
> > +# remove previous $seqres.full before test
> > +rm -f $seqres.full
> > +
> > +# real QA test starts here
> > +
> > +# Modify as appropriate.
> > +_supported_fs overlay
> > +_supported_os Linux
> > +_require_user
> 
> _require_tmpfs
> 
> > +
> > +# create a tmpfs in $TEST_DIR
> > +tmpfsdir=$TEST_DIR/tmpfs
> > +mkdir -p $tmpfsdir
> > +_require_and_mount_tmpfs $tmpfsdir
> 
> then this simply becomes
> 
> $MOUNT_PROG -t tmpfs tmpfs $tmpfsdir
> 
> If all these look sane to you, I can do this straightforward update at
> commit time.

OK, many thanks!

> 
> Thanks,
> Eryu
> 
> > +
> > +mkdir -p $tmpfsdir/{lower,upper,work,mnt}
> > +mkdir -p -m 0 $tmpfsdir/upper/testd
> > +# grant permission for $qa_user
> > +setfacl -m u:$qa_user:rx $tmpfsdir/upper/testd
> > +
> > +# mount overlay using dirs in tmpfs
> > +_overlay_mount_dirs $tmpfsdir/{lower,upper,work,overlay,mnt}
> > +
> > +# user accessing test dir, should be OKay
> > +_user_do "ls $tmpfsdir/mnt/testd"
> > +
> > +echo "Silence is golden"
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/overlay/025.out b/tests/overlay/025.out
> > new file mode 100644
> > index 0000000..3d70951
> > --- /dev/null
> > +++ b/tests/overlay/025.out
> > @@ -0,0 +1,2 @@
> > +QA output created by 025
> > +Silence is golden
> > diff --git a/tests/overlay/group b/tests/overlay/group
> > index 0563a04..82fe69e 100644
> > --- a/tests/overlay/group
> > +++ b/tests/overlay/group
> > @@ -27,3 +27,4 @@
> >  022 auto quick
> >  023 auto quick attr
> >  024 auto quick
> > +025 auto quick attr
> > -- 
> > 1.8.3.1
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe fstests" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [xfstests v4 8/8] overlay: accessing stacked overlayfs files
  2017-02-23  9:42 ` [xfstests v4 8/8] overlay: accessing stacked overlayfs files Xiong Zhou
@ 2017-03-03  8:19   ` Amir Goldstein
  0 siblings, 0 replies; 18+ messages in thread
From: Amir Goldstein @ 2017-03-03  8:19 UTC (permalink / raw)
  To: Xiong Zhou, Eryu Guan; +Cc: fstests, linux-unionfs, Miklos Szeredi

On Thu, Feb 23, 2017 at 11:42 AM, Xiong Zhou <xzhou@redhat.com> wrote:
> Lower dir comes from another overlayfs dir, then
> accessing files in it should work.
>
> CC: Miklos Szeredi <mszeredi@redhat.com>
> Signed-off-by: Xiong Zhou <xzhou@redhat.com>
> ---

FYI, this test triggers a false positive lockdep splat.
I did not notice it earlier, because I carry a fix patch that Miklos
did not pick up yet.

The fix patch is here:
http://www.spinics.net/lists/linux-unionfs/msg01428.html

overlay/029 [08:14:06]
=============================================
[ INFO: possible recursive locking detected ]
4.9.0-debug-12264-g60ae0f1 #426 Not tainted
---------------------------------------------
cat/3367 is trying to acquire lock:
 (&sb->s_type->i_mutex_key#15){.+.+.+}, at: [<ffffffff81217858>]
lookup_slow+0x81/0x185

but task is already holding lock:
 (&sb->s_type->i_mutex_key#15){.+.+.+}, at: [<ffffffff8121b955>]
do_last+0x179/0x608

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(&sb->s_type->i_mutex_key#15);
  lock(&sb->s_type->i_mutex_key#15);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

1 lock held by cat/3367:
 #0:  (&sb->s_type->i_mutex_key#15){.+.+.+}, at: [<ffffffff8121b955>]
do_last+0x179/0x608

stack backtrace:
CPU: 0 PID: 3367 Comm: cat Not tainted 4.9.0-debug-12264-g60ae0f1 #426
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
Ubuntu-1.8.2-1ubuntu1 04/01/2014
Call Trace:
 dump_stack+0x85/0xbe
 __lock_acquire+0x1082/0x153f
 ? mark_held_locks+0x5e/0x74
 lock_acquire+0x13b/0x1d6
 ? lock_acquire+0x13b/0x1d6
 ? lookup_slow+0x81/0x185
 down_read+0x43/0x9a
 ? lookup_slow+0x81/0x185
 lookup_slow+0x81/0x185
 lookup_one_len_unlocked+0xca/0xdc
 ovl_lookup_single+0x30/0x2c6
 ? ovl_lookup+0x158/0x414
 ovl_lookup_layer+0x46/0x137
 ovl_lookup+0x1b5/0x414
 ? __d_lookup+0x22a/0x23c
 lookup_open+0x44c/0x622
 ? lookup_open+0x44c/0x622
 ? rwsem_down_read_failed+0x25/0x164
 do_last+0x196/0x608
 ? path_init+0x2d9/0x681
 path_openat+0x285/0x30c
 ? __might_fault+0x37/0x84
 do_filp_open+0x4d/0xa3
 ? sched_clock+0x9/0xd
 ? __alloc_fd+0x1af/0x1c1
 ? _raw_spin_unlock+0x27/0x31
 do_sys_open+0x13c/0x1cb
 ? do_sys_open+0x13c/0x1cb
 SyS_open+0x1e/0x20
 entry_SYSCALL_64_fastpath+0x1f/0xc2
RIP: 0033:0x7f253e9d7960
RSP: 002b:00007fff5caeba48 EFLAGS: 00000246 ORIG_RAX: 0000000000000002
RAX: ffffffffffffffda RBX: 00007fff5caebca8 RCX: 00007f253e9d7960
RDX: 0000000000020000 RSI: 0000000000000000 RDI: 00007fff5caee235
RBP: 0000000000001000 R08: 0000000000000000 R09: 0000000000000000
R10: 00007fff5caeb810 R11: 0000000000000246 R12: 00000000004025a6
R13: 00007fff5caebca0 R14: 0000000000000000 R15: 0000000000000000
 [08:14:07] 1s

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

* Re: [xfstests v4 6/8] overlay: can not change underlying immutable file
  2017-02-23  9:42 ` [xfstests v4 6/8] overlay: can not change underlying immutable file Xiong Zhou
@ 2017-04-04 11:19   ` Amir Goldstein
  2017-04-04 16:31     ` Amir Goldstein
  0 siblings, 1 reply; 18+ messages in thread
From: Amir Goldstein @ 2017-04-04 11:19 UTC (permalink / raw)
  To: Xiong Zhou, Eryu Guan; +Cc: fstests

On Thu, Feb 23, 2017 at 11:42 AM, Xiong Zhou <xzhou@redhat.com> wrote:
> Even timestamp change by touch.
>
> CC: Miklos Szeredi <mszeredi@redhat.com>
> Signed-off-by: Xiong Zhou <xzhou@redhat.com>
> ---
>  tests/overlay/027     | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/overlay/027.out |  2 ++
>  tests/overlay/group   |  1 +
>  3 files changed, 90 insertions(+)
>  create mode 100755 tests/overlay/027
>  create mode 100644 tests/overlay/027.out
>
> diff --git a/tests/overlay/027 b/tests/overlay/027
> new file mode 100755
> index 0000000..4bb0329
> --- /dev/null
> +++ b/tests/overlay/027
> @@ -0,0 +1,87 @@
> +#! /bin/bash
> +# FS QA Test 027
> +#
> +# If underlying upper file is immutable, it should stays
> +# untouchable in the overlayfs mount.
> +#
> +# Kernel commit below fixed it.
> +# f2b20f6ee842 vfs: move permission checking into ...
> +#
> +# This reproducer was originally written by
> +#     Miklos Szeredi <mszeredi@redhat.com>
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2017 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 /
> +       $CHATTR_PROG -i $upperdir/foo
> +       rm -f $tmp.*
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# remove previous $seqres.full before test
> +rm -f $seqres.full
> +
> +# real QA test starts here
> +
> +# Modify as appropriate.
> +_supported_fs overlay
> +_supported_os Linux
> +_require_scratch
> +_require_chattr
> +

Eryu,

A way-post-merge bug spotting:
Should be "_require_chattr i".
_require_chattr alone makes no sense (and should probably be reported
as an error)

I may get to send a fix, but not too soon..

> +# Remove all files from previous tests
> +_scratch_mkfs
> +
> +# Preparing immutable file
> +upperdir=$SCRATCH_DEV/$OVERLAY_UPPER_DIR
> +mkdir -p $upperdir
> +touch $upperdir/foo
> +$CHATTR_PROG +i $upperdir/foo
> +
> +# Mounting overlay
> +_scratch_mount
> +
> +# Touching immutable file in overlay, should fail.
> +# Not filtering output here because of errno returned
> +# varies among kernel versions:
> +#   touch: setting times of 'foo': Operation not permitted
> +#   touch: cannot touch 'foo': Permission denied
> +if touch $SCRATCH_MNT/foo > /dev/null 2>&1 ; then
> +       echo "Test Fail, you can't change an immutable file"
> +else
> +       echo "Silence is golden"
> +fi
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/overlay/027.out b/tests/overlay/027.out
> new file mode 100644
> index 0000000..ef78cda
> --- /dev/null
> +++ b/tests/overlay/027.out
> @@ -0,0 +1,2 @@
> +QA output created by 027
> +Silence is golden
> diff --git a/tests/overlay/group b/tests/overlay/group
> index 92afa8d..4db6751 100644
> --- a/tests/overlay/group
> +++ b/tests/overlay/group
> @@ -29,3 +29,4 @@
>  024 auto quick
>  025 auto quick attr
>  026 auto attr quick
> +027 auto quick perms
> --
> 1.8.3.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [xfstests v4 6/8] overlay: can not change underlying immutable file
  2017-04-04 11:19   ` Amir Goldstein
@ 2017-04-04 16:31     ` Amir Goldstein
  2017-04-05  2:25       ` Xiong Zhou
  2017-04-05  2:50       ` Eryu Guan
  0 siblings, 2 replies; 18+ messages in thread
From: Amir Goldstein @ 2017-04-04 16:31 UTC (permalink / raw)
  To: Xiong Zhou, Eryu Guan; +Cc: fstests, David Howells

On Tue, Apr 4, 2017 at 2:19 PM, Amir Goldstein <amir73il@gmail.com> wrote:
> On Thu, Feb 23, 2017 at 11:42 AM, Xiong Zhou <xzhou@redhat.com> wrote:
[...]
>> +
>> +# Modify as appropriate.
>> +_supported_fs overlay
>> +_supported_os Linux
>> +_require_scratch
>> +_require_chattr
>> +
>
> Eryu,
>
> A way-post-merge bug spotting:
> Should be "_require_chattr i".
> _require_chattr alone makes no sense (and should probably be reported
> as an error)
>
> I may get to send a fix, but not too soon..
>

Apparently, _require_chattr with no arguments does do what it is expected to do,
or as David wrote in the new documentation patch:
"The test requires that the chattr command be available and supported by
the $TEST_DEV filesystem"

But it appears to be doing the right thing by coincidence??
Without any arguments to _require_chattr, it ends up executing

chattr + $file

and

chattr - file

The former, surprisingly does do FS_IOC_GETFLAGS and FS_IOC_SETFLAGS
on the file, so the check is correct.

The latter spews this error into full output "Must use '-v', =, - or +"
and ignored the failure - again correct, but seems unintentional.

I wonder if we should forbid the use of _require_chattr with no args?
It's only user right now is test overlay/027 and that seems like a bug
(test should _require_chattr i).

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

* Re: [xfstests v4 6/8] overlay: can not change underlying immutable file
  2017-04-04 16:31     ` Amir Goldstein
@ 2017-04-05  2:25       ` Xiong Zhou
  2017-04-05  2:50       ` Eryu Guan
  1 sibling, 0 replies; 18+ messages in thread
From: Xiong Zhou @ 2017-04-05  2:25 UTC (permalink / raw)
  To: Amir Goldstein; +Cc: Xiong Zhou, Eryu Guan, fstests, David Howells

On Tue, Apr 04, 2017 at 07:31:46PM +0300, Amir Goldstein wrote:
> On Tue, Apr 4, 2017 at 2:19 PM, Amir Goldstein <amir73il@gmail.com> wrote:
> > On Thu, Feb 23, 2017 at 11:42 AM, Xiong Zhou <xzhou@redhat.com> wrote:
> [...]
> >> +
> >> +# Modify as appropriate.
> >> +_supported_fs overlay
> >> +_supported_os Linux
> >> +_require_scratch
> >> +_require_chattr
> >> +
> >
> > Eryu,
> >
> > A way-post-merge bug spotting:
> > Should be "_require_chattr i".
> > _require_chattr alone makes no sense (and should probably be reported
> > as an error)
> >
> > I may get to send a fix, but not too soon..
> >
> 
> Apparently, _require_chattr with no arguments does do what it is expected to do,
> or as David wrote in the new documentation patch:
> "The test requires that the chattr command be available and supported by
> the $TEST_DEV filesystem"
> 
> But it appears to be doing the right thing by coincidence??
> Without any arguments to _require_chattr, it ends up executing
> 
> chattr + $file
> 
> and
> 
> chattr - file
> 
> The former, surprisingly does do FS_IOC_GETFLAGS and FS_IOC_SETFLAGS
> on the file, so the check is correct.
> 
> The latter spews this error into full output "Must use '-v', =, - or +"
> and ignored the failure - again correct, but seems unintentional.
> 
> I wonder if we should forbid the use of _require_chattr with no args?
> It's only user right now is test overlay/027 and that seems like a bug
> (test should _require_chattr i).

Yes, it's a bug, my bad.

Thanks for catching this, good job!

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

* Re: [xfstests v4 6/8] overlay: can not change underlying immutable file
  2017-04-04 16:31     ` Amir Goldstein
  2017-04-05  2:25       ` Xiong Zhou
@ 2017-04-05  2:50       ` Eryu Guan
  2017-04-05 10:52         ` Amir Goldstein
  1 sibling, 1 reply; 18+ messages in thread
From: Eryu Guan @ 2017-04-05  2:50 UTC (permalink / raw)
  To: Amir Goldstein; +Cc: Xiong Zhou, fstests, David Howells

[Sorry for the late response, was in public holiday]

On Tue, Apr 04, 2017 at 07:31:46PM +0300, Amir Goldstein wrote:
> On Tue, Apr 4, 2017 at 2:19 PM, Amir Goldstein <amir73il@gmail.com> wrote:
> > On Thu, Feb 23, 2017 at 11:42 AM, Xiong Zhou <xzhou@redhat.com> wrote:
> [...]
> >> +
> >> +# Modify as appropriate.
> >> +_supported_fs overlay
> >> +_supported_os Linux
> >> +_require_scratch
> >> +_require_chattr
> >> +
> >
> > Eryu,
> >
> > A way-post-merge bug spotting:
> > Should be "_require_chattr i".
> > _require_chattr alone makes no sense (and should probably be reported
> > as an error)
> >
> > I may get to send a fix, but not too soon..
> >
> 
> Apparently, _require_chattr with no arguments does do what it is expected to do,
> or as David wrote in the new documentation patch:
> "The test requires that the chattr command be available and supported by
> the $TEST_DEV filesystem"
> 
> But it appears to be doing the right thing by coincidence??
> Without any arguments to _require_chattr, it ends up executing
> 
> chattr + $file
> 
> and
> 
> chattr - file
> 
> The former, surprisingly does do FS_IOC_GETFLAGS and FS_IOC_SETFLAGS
> on the file, so the check is correct.
> 
> The latter spews this error into full output "Must use '-v', =, - or +"
> and ignored the failure - again correct, but seems unintentional.
> 
> I wonder if we should forbid the use of _require_chattr with no args?

I agreed. Do you mind sending a fix?

> It's only user right now is test overlay/027 and that seems like a bug
> (test should _require_chattr i).

Agreed. Xiong has acknowledged the bug, hopefully he will send a fix.

Thanks for finding this!

Eryu

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

* Re: [xfstests v4 6/8] overlay: can not change underlying immutable file
  2017-04-05  2:50       ` Eryu Guan
@ 2017-04-05 10:52         ` Amir Goldstein
  0 siblings, 0 replies; 18+ messages in thread
From: Amir Goldstein @ 2017-04-05 10:52 UTC (permalink / raw)
  To: Eryu Guan; +Cc: Xiong Zhou, fstests, David Howells

On Wed, Apr 5, 2017 at 5:50 AM, Eryu Guan <eguan@redhat.com> wrote:
> [Sorry for the late response, was in public holiday]
>
> On Tue, Apr 04, 2017 at 07:31:46PM +0300, Amir Goldstein wrote:
>> On Tue, Apr 4, 2017 at 2:19 PM, Amir Goldstein <amir73il@gmail.com> wrote:
>> > On Thu, Feb 23, 2017 at 11:42 AM, Xiong Zhou <xzhou@redhat.com> wrote:
>> [...]
>> >> +
>> >> +# Modify as appropriate.
>> >> +_supported_fs overlay
>> >> +_supported_os Linux
>> >> +_require_scratch
>> >> +_require_chattr
>> >> +
>> >
>> > Eryu,
>> >
>> > A way-post-merge bug spotting:
>> > Should be "_require_chattr i".
>> > _require_chattr alone makes no sense (and should probably be reported
>> > as an error)
>> >
>> > I may get to send a fix, but not too soon..
>> >
>>
>> Apparently, _require_chattr with no arguments does do what it is expected to do,
>> or as David wrote in the new documentation patch:
>> "The test requires that the chattr command be available and supported by
>> the $TEST_DEV filesystem"
>>
>> But it appears to be doing the right thing by coincidence??
>> Without any arguments to _require_chattr, it ends up executing
>>
>> chattr + $file
>>
>> and
>>
>> chattr - file
>>
>> The former, surprisingly does do FS_IOC_GETFLAGS and FS_IOC_SETFLAGS
>> on the file, so the check is correct.
>>
>> The latter spews this error into full output "Must use '-v', =, - or +"
>> and ignored the failure - again correct, but seems unintentional.
>>
>> I wonder if we should forbid the use of _require_chattr with no args?
>
> I agreed. Do you mind sending a fix?

Fix sent.

>
>> It's only user right now is test overlay/027 and that seems like a bug
>> (test should _require_chattr i).
>
> Agreed. Xiong has acknowledged the bug, hopefully he will send a fix.
>

While at it, I noticed that overlay/027 only tests immutable regular files
but overlay actually fails some immutable directory tests and append-only
files (and dirs) test, so created overlay/030 to test those (it is failing).

Amir.

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

end of thread, other threads:[~2017-04-05 10:52 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-23  9:42 [xfstests v4 0/8] bunch of overlay tests Xiong Zhou
2017-02-23  9:42 ` [xfstests v4 1/8] overlay: disallow overlayfs as upperdir Xiong Zhou
2017-02-23  9:42 ` [xfstests v4 2/8] overlay: work dir in overlay inherits no ACLs Xiong Zhou
2017-02-23 10:44   ` Eryu Guan
2017-02-23  9:42 ` [xfstests v4 3/8] overlay: test workdir cleanup in mounting Xiong Zhou
2017-02-23  9:42 ` [xfstests v4 4/8] overlay: permission check with cached acls in tmpfs Xiong Zhou
2017-02-23 10:52   ` Eryu Guan
2017-02-23 12:49     ` Xiong Zhou
2017-02-23  9:42 ` [xfstests v4 5/8] overlay: filter out xattr starts with "trusted.overlay." Xiong Zhou
2017-02-23  9:42 ` [xfstests v4 6/8] overlay: can not change underlying immutable file Xiong Zhou
2017-04-04 11:19   ` Amir Goldstein
2017-04-04 16:31     ` Amir Goldstein
2017-04-05  2:25       ` Xiong Zhou
2017-04-05  2:50       ` Eryu Guan
2017-04-05 10:52         ` Amir Goldstein
2017-02-23  9:42 ` [xfstests v4 7/8] overlay: test flock after copied up Xiong Zhou
2017-02-23  9:42 ` [xfstests v4 8/8] overlay: accessing stacked overlayfs files Xiong Zhou
2017-03-03  8:19   ` Amir Goldstein

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.