summaryrefslogtreecommitdiff
path: root/tests/generic/741
blob: 1152b8c7873779176ef97b40f83f2f90ae6f5107 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2024 Oracle.  All Rights Reserved.
#
# FS QA Test 741
#
# Attempt to mount both the DM physical device and the DM flakey device.
# Verify the returned error message.
#
. ./common/preamble
_begin_fstest auto quick volume tempfsid

# Override the default cleanup function.
_cleanup()
{
	umount $extra_mnt &> /dev/null
	rm -rf $extra_mnt
	_unmount_flakey
	_cleanup_flakey
	cd /
	rm -r -f $tmp.*
}

# Import common functions.
. ./common/filter
. ./common/dmflakey

# real QA test starts here
_supported_fs generic
_require_test
_require_scratch
_require_dm_target flakey

[ "$FSTYP" = "btrfs" ] && _fixed_by_kernel_commit 2f1aeab9fca1 \
			"btrfs: return accurate error code on open failure"

[[ $FSTYP == bcachefs ]] && _notrun "mount.bcachefs logs extra output"

_scratch_mkfs >> $seqres.full
_init_flakey
_mount_flakey

extra_mnt=$TEST_DIR/extra_mnt
rm -rf $extra_mnt
mkdir -p $extra_mnt

# Mount must fail because the physical device has a dm created on it.
# Filters alter the return code of the mount.
_mount $SCRATCH_DEV $extra_mnt 2>&1 | \
			_filter_testdir_and_scratch | _filter_error_mount

# Try again with flakey unmounted, must fail.
_unmount_flakey
_mount $SCRATCH_DEV $extra_mnt 2>&1 | \
			_filter_testdir_and_scratch | _filter_error_mount

# Removing dm should make mount successful.
_cleanup_flakey
_scratch_mount

status=0
exit