xfs: force file creation to the data device for certain layout tests
[xfstests-dev.git] / tests / btrfs / 075
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2014 Red Hat Inc. All rights reserved.
4 #
5 # FSQA Test No. btrfs/075
6 #
7 # If one subvolume was mounted with selinux context, other subvolumes
8 # should be able to be mounted with the same selinux context too.
9 #
10 seq=`basename $0`
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
13
14 here=`pwd`
15 tmp=/tmp/$$
16 status=1
17 trap "_cleanup; exit \$status" 0 1 2 3 15
18
19 _cleanup()
20 {
21         cd /
22         rm -f $tmp.*
23         $UMOUNT_PROG $subvol_mnt >/dev/null 2>&1
24 }
25
26 # get standard environment, filters and checks
27 . ./common/rc
28 . ./common/filter
29
30 # real QA test starts here
31 _supported_fs btrfs
32 _require_scratch
33
34 # SELINUX_MOUNT_OPTIONS will be set in common/config if selinux is enabled
35 if [ "$SELINUX_MOUNT_OPTIONS" == "" ]; then
36         _notrun "Require selinux to be enabled"
37 fi
38
39 rm -f $seqres.full
40 echo "Silence is golden"
41
42 # first mount default subvolume with selinux context set
43 _scratch_mkfs >$seqres.full 2>&1
44 _scratch_mount
45
46 # create a new subvolume and mount it with the same selinux context
47 subvol_mnt=$TEST_DIR/$seq.mnt
48 mkdir -p $subvol_mnt
49 $BTRFS_UTIL_PROG subvolume create $SCRATCH_MNT/subvol >>$seqres.full 2>&1
50 $MOUNT_PROG -o subvol=subvol $SELINUX_MOUNT_OPTIONS $SCRATCH_DEV $subvol_mnt
51 status=$?
52
53 exit