2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015 Red Hat Inc. All Rights Reserved.
7 # Exercise fs freeze/unfreeze and mount/umount race, which could lead to
10 # This commit fixed the issue:
11 # 1494583 fix get_active_super()/umount() race
14 seqres=$RESULT_DIR/$seq
15 echo "QA output created by $seq"
19 status=1 # failure is the default!
20 trap "_cleanup; exit \$status" 0 1 2 3 15
31 # in case it's still suspended and/or mounted
32 $DMSETUP_PROG resume $lvdev >/dev/null 2>&1
33 $UMOUNT_PROG $lvdev >/dev/null 2>&1
37 # get standard environment, filters and checks
41 # real QA test starts here
45 _require_block_device $SCRATCH_DEV
46 _require_dm_target linear
51 table="0 $size_in_sector linear $SCRATCH_DEV 0"
52 _dmsetup_create $node --table "$table" || \
53 _fail "setup dm device failed"
57 echo "Silence is golden"
59 size=$((256 * 1024 * 1024))
60 size_in_sector=$((size / 512))
61 _scratch_mkfs_sized $size >>$seqres.full 2>&1
64 lvdev=/dev/mapper/$node
67 # take use of dmsetup suspend to freeze the fs.
68 # xfs_freeze/fsfreeze cannot be used in this test, because it can possibly
69 # freeze the root fs of the host when SCRATCH_MNT is not mounted
71 # And the results of the racing commands (suspend/resume, mount/umount) are not
72 # important, as long as they're racing with each other. So just throw away the
73 # outputs and ignore the results.
74 for ((i=0; i<100; i++)); do
75 $DMSETUP_PROG suspend $lvdev >/dev/null 2>&1
76 $DMSETUP_PROG resume $lvdev >/dev/null 2>&1
79 for ((i=0; i<100; i++)); do
80 $MOUNT_PROG $lvdev $SCRATCH_MNT >/dev/null 2>&1
81 $UMOUNT_PROG $lvdev >/dev/null 2>&1