generic: test adding filesystem-level fscrypt key via key_id
[xfstests-dev.git] / tests / generic / 481
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2018 Oracle. All Rights Reserved.
4 #
5 # FSQA Test No. 481
6 #
7 # Reproduce a regression of btrfs that leads to -EEXIST on creating new files
8 # after log replay.
9 #
10 # The kernel fix is
11 #   Btrfs: fix unexpected -EEXIST when creating new inode
12 #
13 seq=`basename $0`
14 seqres=$RESULT_DIR/$seq
15 echo "QA output created by $seq"
16 tmp=/tmp/$$
17 status=1        # failure is the default!
18 trap "_cleanup; exit \$status" 0 1 2 3 15
19
20 _cleanup()
21 {
22         _cleanup_flakey
23         cd /
24         rm -f $tmp.*
25 }
26
27 # get standard environment, filters and checks
28 . ./common/rc
29 . ./common/filter
30 . ./common/dmflakey
31
32 # real QA test starts here
33 _supported_fs generic
34 _supported_os Linux
35 _require_scratch
36 _require_dm_target flakey
37
38 rm -f $seqres.full
39
40 _scratch_mkfs >>$seqres.full 2>&1
41 _require_metadata_journaling $SCRATCH_DEV
42 _init_flakey
43 _mount_flakey
44
45 # create a file and keep it in write ahead log
46 $XFS_IO_PROG -f -c "fsync" $SCRATCH_MNT/foo
47
48 # fail this filesystem so that remount can replay the write ahead log
49 _flakey_drop_and_remount
50
51 # see if we can create a new file successfully
52 touch $SCRATCH_MNT/bar
53
54 _unmount_flakey
55
56 echo "Silence is golden"
57
58 status=0
59 exit