blob: 4c5d69e71c9abe308dc2508e62de0d2f576c1ccf (
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
|
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2021 SUSE Linux Products GmbH. All Rights Reserved.
#
# FS QA Test 244
#
# Make sure "btrfs device remove" won't crash when non-existing devid
# is provided
#
. ./common/preamble
_begin_fstest auto quick volume dangerous
# Override the default cleanup function.
# _cleanup()
# {
# cd /
# rm -r -f $tmp.*
# }
_supported_fs btrfs
_require_scratch
_scratch_mkfs >> $seqres.full 2>&1
_scratch_mount
# Above created fs only contains one device with devid 1, device remove 3
# should just fail with proper error message showing devid 3 can't be found.
# Although on unpatched kernel, this will trigger a NULL pointer dereference.
$BTRFS_UTIL_PROG device remove 3 $SCRATCH_MNT
ret=$?
if [ $ret -ne 1 ]; then
echo "Unexpected return value from btrfs command, has $ret expected 1"
fi
# Fstests will automatically check the filesystem to make sure metadata is not
# corrupted.
# success, all done
status=0
exit
|