common/rc: add _scratch_{u}mount_idmapped() helpers
[xfstests-dev.git] / tests / ext4 / 305
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2013 Red Hat, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 305
6 #
7 # Regression test for commit:
8 # 9559996 ext4: remove mb_groups before tearing down the buddy_cache
9 #
10 seq=`basename $0`
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
13
14 PIDS=""
15 status=1        # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
17
18 _cleanup()
19 {
20     cd /
21     kill $PIDS >/dev/null 2>&1
22 }
23
24 # get standard environment, filters and checks
25 . ./common/rc
26 . ./common/filter
27
28 # real QA test starts here
29 _supported_fs ext4
30
31 _require_scratch
32
33 rm -f $seqres.full
34 echo "Silence is golden"
35
36 DEV_BASENAME=$(_short_dev $SCRATCH_DEV)
37 echo "Start test on device $SCRATCH_DEV, basename $DEV_BASENAME" >$seqres.full
38 _scratch_mkfs >>$seqres.full 2>&1
39
40 while true; do
41         cat /proc/fs/ext4/$DEV_BASENAME/mb_groups > /dev/null 2>&1
42 done &
43 PIDS=$!
44
45 # 30 loops is enough to crash a buggy kernel
46 i=0
47 while [ $i -lt 30 ]; do
48         _try_scratch_mount
49         _scratch_unmount
50         let i=i+1
51 done
52
53 # no BUG_ON, all done
54 kill $PIDS >/dev/null 2>&1
55 wait
56 status=0
57 exit