2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2020 Oracle. All Rights Reserved.
7 # Test if the show_devname() returns sprout device instead of seed device.
9 # Fixed in kernel patch:
10 # btrfs: btrfs_show_devname don't traverse into the seed fsid
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
18 status=1 # failure is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 15
27 # get standard environment, filters and checks
31 # remove previous $seqres.full before test
34 # real QA test starts here
36 _require_scratch_dev_pool 2
38 _scratch_dev_pool_get 2
40 seed=$(echo $SCRATCH_DEV_POOL | awk '{print $1}')
41 sprout=$(echo $SCRATCH_DEV_POOL | awk '{print $2}')
44 $BTRFS_TUNE_PROG -S 1 $seed
45 _mount $seed $SCRATCH_MNT >> $seqres.full 2>&1
46 cat /proc/self/mounts | grep $seed >> $seqres.full
47 $BTRFS_UTIL_PROG device add -f $sprout $SCRATCH_MNT
48 cat /proc/self/mounts | grep $sprout >> $seqres.full
50 # check if the show_devname() returns the sprout device instead of seed device.
51 dev=$(grep $SCRATCH_MNT /proc/self/mounts | $AWK_PROG '{print $1}')
53 if [ "$sprout" != "$dev" ]; then
54 echo "Unexpected device: $dev, expected $sprout"
56 echo "Silence is golden"