Check l2cache vdevs pending list inside the vdev_inuse()

The l2cache device could be added twice because vdev_inuse() does not
check spa_l2cache for added devices. Make l2cache vdevs inuse checking
logic more closer to spare vdevs.

Reviewed-by: George Amanakis <gamanakis@gmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Fedor Uporov <fuporov.vstack@gmail.com>
Closes #9153 
Closes #12689
This commit is contained in:
Fedor Uporov
2021-11-11 11:54:15 -08:00
committed by GitHub
parent d04b5c9e87
commit 49d42425d6
4 changed files with 45 additions and 12 deletions
@@ -39,8 +39,9 @@
#
# STRATEGY:
# 1. Create a storage pool
# 2. Add the two same devices to pool A
# 3. Add the device in pool A to pool A again
# 2. Add the device in pool A to pool A again
# 3. Add the two devices to pool A in the loop, one of them already
# added or same device added multiple times
#
verify_runnable "global"
@@ -58,8 +59,13 @@ log_onexit cleanup
create_pool $TESTPOOL $DISK0
log_must poolexists $TESTPOOL
log_mustnot zpool add -f $TESTPOOL $DISK1 $DISK1
log_mustnot zpool add -f $TESTPOOL $DISK0
for type in "" "mirror" "raidz" "draid" "spare" "log" "dedup" "special" "cache"
do
log_mustnot zpool add -f $TESTPOOL $type $DISK0 $DISK1
log_mustnot zpool add -f $TESTPOOL $type $DISK1 $DISK1
done
log_pass "'zpool add' get fail as expected if vdevs are the same or vdev is " \
"contained in the given pool."