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 _begin_fstest auto freeze mount
16 # Override the default cleanup function.
26 # in case it's still suspended and/or mounted
27 $DMSETUP_PROG resume $lvdev >/dev/null 2>&1
28 [ -n "$pid" ] && kill -9 $pid 2>/dev/null
30 $UMOUNT_PROG $lvdev >/dev/null 2>&1
34 # Import common functions.
37 # real QA test starts here
40 _require_block_device $SCRATCH_DEV
41 _require_dm_target linear
46 table="0 $size_in_sector linear $SCRATCH_DEV 0"
47 _dmsetup_create $node --table "$table" || \
48 _fail "setup dm device failed"
51 echo "Silence is golden"
53 size=$((256 * 1024 * 1024))
54 size_in_sector=$((size / 512))
55 _scratch_mkfs_sized $size >>$seqres.full 2>&1
58 lvdev=/dev/mapper/$node
61 # take use of dmsetup suspend to freeze the fs.
62 # xfs_freeze/fsfreeze cannot be used in this test, because it can possibly
63 # freeze the root fs of the host when SCRATCH_MNT is not mounted
65 # And the results of the racing commands (suspend/resume, mount/umount) are not
66 # important, as long as they're racing with each other. So just throw away the
67 # outputs and ignore the results.
68 for ((i=0; i<100; i++)); do
69 $DMSETUP_PROG suspend $lvdev >/dev/null 2>&1
70 $DMSETUP_PROG resume $lvdev >/dev/null 2>&1
73 for ((i=0; i<100; i++)); do
74 $MOUNT_PROG $lvdev $SCRATCH_MNT >/dev/null 2>&1
75 $UMOUNT_PROG $lvdev >/dev/null 2>&1