]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
btrfs: test mount btrfs subvolume with selinux context
authorEryu Guan <eguan@redhat.com>
Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)
committerDave Chinner <david@fromorbit.com>
Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)
If one subvolume was mounted with selinux context, other subvolumes
should be able to be mounted with the same selinux context too.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
tests/btrfs/075 [new file with mode: 0755]
tests/btrfs/075.out [new file with mode: 0644]
tests/btrfs/group

diff --git a/tests/btrfs/075 b/tests/btrfs/075
new file mode 100755 (executable)
index 0000000..16ed854
--- /dev/null
@@ -0,0 +1,70 @@
+#! /bin/bash
+# FSQA Test No. btrfs/075
+#
+# If one subvolume was mounted with selinux context, other subvolumes
+# should be able to be mounted with the same selinux context too.
+#
+#-----------------------------------------------------------------------
+# Copyright (C) 2014 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
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+       cd /
+       rm -f $tmp.*
+       $UMOUNT_PROG $subvol_mnt >/dev/null 2>&1
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs btrfs
+_supported_os Linux
+_require_scratch
+
+# SELINUX_MOUNT_OPTIONS will be set in common/config if selinux is enabled
+if [ "$SELINUX_MOUNT_OPTIONS" == "" ]; then
+       _notrun "Require selinux to be enabled"
+fi
+
+rm -f $seqres.full
+echo "Silence is golden"
+
+# first mount default subvolume with selinux context set
+_scratch_mkfs >$seqres.full 2>&1
+_scratch_mount
+
+# create a new subvolume and mount it with the same selinux context
+subvol_mnt=$TEST_DIR/$seq.mnt
+mkdir -p $subvol_mnt
+$BTRFS_UTIL_PROG subvolume create $SCRATCH_MNT/subvol >>$seqres.full 2>&1
+$MOUNT_PROG -o subvol=subvol $SELINUX_MOUNT_OPTIONS $SCRATCH_DEV $subvol_mnt
+status=$?
+
+exit
diff --git a/tests/btrfs/075.out b/tests/btrfs/075.out
new file mode 100644 (file)
index 0000000..ded801b
--- /dev/null
@@ -0,0 +1,2 @@
+QA output created by 075
+Silence is golden
index c8ac72cea012c11fe0bfefa87a0ce60d2245aa31..00ae8cebb429a6adde00f8d1f9c5f5c30872e64b 100644 (file)
@@ -77,3 +77,4 @@
 072 auto scrub defrag compress
 073 auto scrub remount compress
 074 auto defrag remount compress
+075 auto quick subvol