xfs/144: Use _qsetup instead of qsetup
[xfstests-dev.git] / tests / overlay / 008
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Red Hat Inc.  All Rights Reserved.
4 #
5 # FS QA Test 008
6 #
7 # Create file/dir over whiteout by another user, uid/gid of the file/dir should
8 # be current fsuid/fsgid, not the mounter's.
9 #
10 # This upstream kernel patch fixed the issue
11 # d0e13f5 ovl: fix uid/gid when creating over whiteout
12 #
13 seq=`basename $0`
14 seqres=$RESULT_DIR/$seq
15 echo "QA output created by $seq"
16
17 here=`pwd`
18 tmp=/tmp/$$
19 status=1        # failure is the default!
20 trap "_cleanup; exit \$status" 0 1 2 3 15
21
22 _cleanup()
23 {
24         cd /
25         rm -f $tmp.*
26 }
27
28 # get standard environment, filters and checks
29 . ./common/rc
30 . ./common/filter
31
32 rm -f $seqres.full
33
34 # real QA test starts here
35 _supported_fs overlay
36 _require_scratch
37 _require_user
38
39 # Remove all files from previous tests
40 _scratch_mkfs
41
42 # Create test file on lower dir, and chown to fsgqa user
43 lowerdir=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER
44 mkdir -p $lowerdir
45 touch $lowerdir/testfile
46 chown fsgqa:fsgqa $lowerdir/testfile
47
48 # chown upperdir to fsgqa user, so new file/dir can be created by the user
49 upperdir=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER
50 mkdir -p $upperdir
51 chown fsgqa:fsgqa $upperdir
52
53 _scratch_mount
54
55 # Remove testfile, whiteout created in lowerdir
56 rm -f $SCRATCH_MNT/testfile
57
58 # Create new file over whiteout and check the file ownership
59 _user_do "touch $SCRATCH_MNT/testfile"
60 stat -c %U:%G-%F $SCRATCH_MNT/testfile
61
62 # Create new dir over whiteout and check ownership again
63 rm -f $SCRATCH_MNT/testfile
64 _user_do "mkdir $SCRATCH_MNT/testfile"
65 stat -c %U:%G-%F $SCRATCH_MNT/testfile
66
67 # success, all done
68 status=0
69 exit