generic: test for file loss after mix of rename, fsync and inode eviction
[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 . ./common/preamble
14 _begin_fstest auto quick log metadata
15
16 # Override the default cleanup function.
17 _cleanup()
18 {
19         _cleanup_flakey
20         cd /
21         rm -f $tmp.*
22 }
23
24 # Import common functions.
25 . ./common/filter
26 . ./common/dmflakey
27
28 # real QA test starts here
29 _supported_fs generic
30 _require_scratch
31 _require_dm_target flakey
32
33 _scratch_mkfs >>$seqres.full 2>&1
34 _require_metadata_journaling $SCRATCH_DEV
35 _init_flakey
36 _mount_flakey
37
38 # create a file and keep it in write ahead log
39 $XFS_IO_PROG -f -c "fsync" $SCRATCH_MNT/foo
40
41 # fail this filesystem so that remount can replay the write ahead log
42 _flakey_drop_and_remount
43
44 # see if we can create a new file successfully
45 touch $SCRATCH_MNT/bar
46
47 _unmount_flakey
48
49 echo "Silence is golden"
50
51 status=0
52 exit