generic/402: Drop useless fail message
[xfstests-dev.git] / tests / generic / 509
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2018 SUSE Linux Products GmbH. All Rights Reserved.
4 #
5 # FS QA Test No. 509
6 #
7 # Test that if we fsync a tmpfile, without adding a hard link to it, and then
8 # power fail, we will be able to mount the filesystem without triggering any
9 # crashes, warnings or corruptions.
10 #
11 seq=`basename $0`
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
14 tmp=/tmp/$$
15 status=1        # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
17
18 _cleanup()
19 {
20         _cleanup_flakey
21         cd /
22         rm -f $tmp.*
23 }
24
25 # get standard environment, filters and checks
26 . ./common/rc
27 . ./common/filter
28 . ./common/dmflakey
29
30 # real QA test starts here
31 _supported_fs generic
32 _require_scratch
33 _require_xfs_io_command "-T"
34 _require_dm_target flakey
35
36 rm -f $seqres.full
37
38 _scratch_mkfs >>$seqres.full 2>&1
39 _require_metadata_journaling $SCRATCH_DEV
40 _init_flakey
41 _mount_flakey
42
43 # Create our tmpfile, write some data to it and fsync it. We want a power
44 # failure to happen after the fsync, so that we have an inode with a link
45 # count of 0 in our log/journal.
46 $XFS_IO_PROG -T \
47         -c "pwrite -S 0xab 0 64K" \
48         -c "fsync" \
49         $SCRATCH_MNT | _filter_xfs_io
50
51 # Simulate a power failure and mount the filesystem to check that it succeeds.
52 _flakey_drop_and_remount
53
54 _unmount_flakey
55
56 status=0
57 exit