generic/520: Remove sync in clean_dir
[xfstests-dev.git] / tests / generic / 491
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2018 CTERA Networks. All Rights Reserved.
4 #
5 # FS QA Test No. 491
6 #
7 # Test first read with freeze right after mount.
8 #
9 # With ext4, this leads to freeze proection bypass WARN_ON in
10 # ext4_journal_check_start.
11 #
12 seq=`basename $0`
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
15
16 here=`pwd`
17 tmp=/tmp/$$
18 status=1        # failure is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 15
20
21 _cleanup()
22 {
23         cd /
24         rm -f $tmp.*
25 }
26
27 # get standard environment, filters and checks
28 . ./common/rc
29 . ./common/filter
30
31 # real QA test starts here
32 _supported_fs generic
33 _supported_os Linux
34 _require_scratch
35 _require_freeze
36 _require_command "$TIMEOUT_PROG" "timeout"
37
38 rm -f $seqres.full
39
40 testfile=$SCRATCH_MNT/foo
41
42 # Create a filesystem with a file
43 _scratch_mkfs >>$seqres.full 2>&1
44 _scratch_mount
45 echo "frozen" > $testfile
46
47 # Mount filesystem "noatime" and freeze right after mount -
48 # reads should not block
49 _scratch_cycle_mount "noatime"
50 xfs_freeze -f $SCRATCH_MNT
51
52 # Read file while filesystem is frozen should succeed
53 # without blocking
54 $TIMEOUT_PROG -s KILL 1s cat $testfile
55
56 xfs_freeze -u $SCRATCH_MNT
57
58 status=0
59 exit