summaryrefslogtreecommitdiff
path: root/tests/ext4/057
blob: 6babedb27c780a576ff956c09f4c84301d756ea6 (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
63
64
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2022 Google, Inc. All Rights Reserved.
#
# Test the set/get UUID ioctl.
#

. ./common/preamble
_begin_fstest auto ioctl

# Override the default cleanup function.
_cleanup()
{
        cd /
        rm -r -f $tmp.*
        kill -9 $fsstress_pid 2>/dev/null;
        wait > /dev/null 2>&1
}

# Import common functions.
. ./common/filter

# real QA test starts here
_supported_fs ext4
_require_scratch
_require_test_program uuid_ioctl
_require_command $UUIDGEN_PROG uuidgen

UUID_IOCTL=$here/src/uuid_ioctl

# If the ioctl is not supported by the kernel, then skip test.
current_uuid=$($UUID_IOCTL get $SCRATCH_MNT 2>&1)
if [[ "$current_uuid" =~ ^Inappropriate[[:space:]]ioctl ]]; then
        _notrun "UUID ioctls are not supported by kernel."
fi

# metadata_csum_seed must be set to decouple checksums from the uuid.
# Otherwise, checksums need to be recomputed when the uuid changes, which
# is not supported by the ioctl.
_scratch_mkfs_ext4 -O metadata_csum_seed >> $seqres.full 2>&1
_scratch_mount

# Begin fsstress while modifying UUID
fsstress_args=$(_scale_fsstress_args -d $SCRATCH_MNT -p 15 -n 999999)
$FSSTRESS_PROG $fsstress_args >> $seqres.full &
fsstress_pid=$!

for n in $(seq 1 20); do
        new_uuid=$($UUIDGEN_PROG)

        echo "Setting UUID to ${new_uuid}" >> $seqres.full 2>&1
        $UUID_IOCTL set $SCRATCH_MNT $new_uuid

        current_uuid=$($UUID_IOCTL get $SCRATCH_MNT)
        echo "$UUID_IOCTL get $SCARTCH_MNT: $current_uuid" >> $seqres.full 2>&1
        if [[ "$current_uuid" != "$new_uuid" ]]; then
                echo "Current UUID ($current_uuid) does not equal what was sent with the ioctl ($new_uuid)"
        fi
done

# success, all done
echo "Silence is golden"
status=0
exit