Project

General

Profile

Actions

Bug #13583

open

zfs test refreserv_multi_raidz can fail

Added by Jason King 8 months ago. Updated 8 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
tests
Start date:
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

Recently, the refreserv_multi_raidz now seems to fail (from a stock illumos-gate):

cannot create 'testpool': one or more vdevs refer to the same device
ERROR: zpool create -f testpool raidz2 c3t0d0 c4t0d0 c5t0d0 raidz2 c3t0d0 c4t0d0 c5t0d0 exited 1
NOTE: Performing test-fail callback (/opt/zfs-tests/callbacks/zfs_dbgmsg)

I suspect this may be related to the ksh93 update, but haven't been able to confirm it 100%. Regardless of the cause though, it should be fixed.

Actions #1

Updated by Jason King 8 months ago

It appears it might be related to this:

for raid in "${!sizes[@]}"; do
        # ksh likes to create a [0] item for us.  Thanks, ksh!
        [[ $raid == "0" ]] && continue
       for nd1 in "${!sizes["$raid"][@]}"; do
                [[ $nd1 == "0" ]] && continue

Adding a set -x prior to that, shows:

NOTE: Too few disks to test raidz1-3 + raidz1=2
+ [[ 3 == 0 ]]
+ check_vdevs raidz1 3 3
NOTE: Too few disks to test raidz1-3 + raidz1=3
+ [[ raidz2 == 0 ]]
+ [[ '' == 0 ]]

Suggesting that perhaps ksh93 no longer is adding [0] for us.
changing [[ $nd1 "0" ]] to [[ $nd1 "0" || -z "$nd1" ]] allows the test to pass.

Actions #2

Updated by Andy Fiddaman 8 months ago

Suggesting that perhaps ksh93 no longer is adding [0] for us.

ksh93 was (and still is) adding the [0] because the array was initialised as it was typeset

af@bloody:/opt/zfs-tests$ typeset -A var1
af@bloody:/opt/zfs-tests$ typeset -A var2=
af@bloody:/opt/zfs-tests$ print -v var1

af@bloody:/opt/zfs-tests$ print -v var2
(
        [0]=''
)

That one is easily fixed by removing the stray = early in the script.

The data structure that the script constructs looks something like:

(
    [raidz1]=(
            [2]=(
                    [1024]=867172352
                    [131072]=106954752
                    [512]=1732247552
            )
            [3]=(
                    [1024]=1146792618
                    [131072]=106954752
                    [512]=2291488085
            )
    )
    [raidz2]=(
                    )
    [raidz3]=(
                    )
)

and the new problem is with those empty raidz2 and raidz3 associative arrays.

af@bloody:/opt/zfs-tests$ typeset -A vvv
af@bloody:/opt/zfs-tests$ typeset -A vvv['raidz2']
af@bloody:/opt/zfs-tests$ print -v vvv
(
        [raidz2]=(
                        )
)
af@bloody:/opt/zfs-tests$ for f in ${!vvv['raidz2'][@]}; do
> echo F: $f
> done
F:

The solution there is to check for an empty key, as you've done

Actions

Also available in: Atom PDF