generic: test for file loss after mix of rename, fsync and inode eviction
[xfstests-dev.git] / tests / generic / 405
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 405
6 #
7 # Test mkfs against thin provision device, which has very small backing size,
8 # mkfs should return error when it hits EIO.
9 #
10 . ./common/preamble
11 _begin_fstest auto mkfs thin
12
13 # Initialize dmthin device with very small backing size & very big virtual
14 # size, with the hope that mkfs hit EIO at mkfs time
15 BACKING_SIZE=$((1 * 1024 * 1024 / 512))                 # 1M
16 VIRTUAL_SIZE=$((1 * 1024 * 1024 * 1024 * 1024 / 512))   # 1T
17
18 # Override the default cleanup function.
19 _cleanup()
20 {
21         _dmthin_cleanup
22         cd /
23         rm -f $tmp.*
24 }
25
26 # Import common functions.
27 . ./common/filter
28 . ./common/dmthin
29
30 # real QA test starts here
31 _supported_fs generic
32 # $SCRATCH_DEV won't be directly created filesystem on, so fsck isn't required
33 _require_scratch_nocheck
34 _require_dm_target thin-pool
35
36 _dmthin_init $BACKING_SIZE $VIRTUAL_SIZE
37
38 # try mkfs on dmthin device, expect mkfs failure if 1M isn't big enough to hold
39 # all the metadata. But if mkfs returns success, we expect the filesystem is
40 # consistent, make sure it doesn't currupt silently.
41 $MKFS_PROG -t $FSTYP $DMTHIN_VOL_DEV >>$seqres.full 2>&1
42 if [ $? -eq 0 ]; then
43         _dmthin_check_fs
44 fi
45
46 echo "Silence is golden"
47 status=0
48 exit