iSCSI hotremove is broken. It relies on C undefined behavior. Some bdev_io may be put after their bdev_channel has been put (freed) and spdk_bdev_put_io may be reading freed bdev_channel memory. iSCSI tasks targetting hotremoved devices are finished immediately. That's usually fine, but these tasks might be subtasks of an r2t chain. Once subtasks are freed, their parent task may be eventually freed as well. If the parent has finished before the hotremoval, its bdev_io has been assigned, so freeing the task will put that bdev_io and that's where undefined behavior hits. There's an ongoing work towards deferring iSCSI hotremove if r2t tasks are present, so this test should be reenabled once that's done. Change-Id: I7fa741b8749d542bcabb211a0969da5d7742eda3 Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/410176 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
110 lines
2.8 KiB
Bash
Executable File
110 lines
2.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
testdir=$(readlink -f $(dirname $0))
|
|
rootdir=$(readlink -f $testdir/../../..)
|
|
source $rootdir/test/common/autotest_common.sh
|
|
source $rootdir/test/iscsi_tgt/common.sh
|
|
|
|
function running_config() {
|
|
# generate a config file from the running iscsi_tgt
|
|
# running_config.sh will leave the file at /tmp/iscsi.conf
|
|
$testdir/running_config.sh $pid
|
|
sleep 1
|
|
|
|
# now start iscsi_tgt again using the generated config file
|
|
# keep the same iscsiadm configuration to confirm that the
|
|
# config file matched the running configuration
|
|
killprocess $pid
|
|
trap "iscsicleanup; exit 1" SIGINT SIGTERM EXIT
|
|
|
|
timing_enter start_iscsi_tgt2
|
|
|
|
$ISCSI_APP -c /tmp/iscsi.conf &
|
|
pid=$!
|
|
echo "Process pid: $pid"
|
|
trap "iscsicleanup; killprocess $pid; exit 1" SIGINT SIGTERM EXIT
|
|
waitforlisten $pid
|
|
echo "iscsi_tgt is listening. Running tests..."
|
|
|
|
timing_exit start_iscsi_tgt2
|
|
|
|
sleep 1
|
|
$fio_py 4096 1 randrw 5
|
|
}
|
|
|
|
if [ -z "$TARGET_IP" ]; then
|
|
echo "TARGET_IP not defined in environment"
|
|
exit 1
|
|
fi
|
|
|
|
if [ -z "$INITIATOR_IP" ]; then
|
|
echo "INITIATOR_IP not defined in environment"
|
|
exit 1
|
|
fi
|
|
|
|
timing_enter fio
|
|
|
|
cp $testdir/iscsi.conf.in $testdir/iscsi.conf
|
|
|
|
MALLOC_BDEV_SIZE=64
|
|
MALLOC_BLOCK_SIZE=4096
|
|
|
|
rpc_py="python $rootdir/scripts/rpc.py"
|
|
fio_py="python $rootdir/scripts/fio.py"
|
|
|
|
timing_enter start_iscsi_tgt
|
|
|
|
$ISCSI_APP -c $testdir/iscsi.conf &
|
|
pid=$!
|
|
echo "Process pid: $pid"
|
|
|
|
trap "killprocess $pid; exit 1" SIGINT SIGTERM EXIT
|
|
|
|
waitforlisten $pid
|
|
echo "iscsi_tgt is listening. Running tests..."
|
|
|
|
timing_exit start_iscsi_tgt
|
|
|
|
$rpc_py add_portal_group $PORTAL_TAG $TARGET_IP:$ISCSI_PORT
|
|
$rpc_py add_initiator_group $INITIATOR_TAG $INITIATOR_NAME $NETMASK
|
|
$rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE
|
|
# "Malloc0:0" ==> use Malloc0 blockdev for LUN0
|
|
# "1:2" ==> map PortalGroup1 to InitiatorGroup2
|
|
# "64" ==> iSCSI queue depth 64
|
|
# "-d" ==> disable CHAP authentication
|
|
$rpc_py construct_target_node Target3 Target3_alias 'Malloc0:0' $PORTAL_TAG:$INITIATOR_TAG 64 -d
|
|
sleep 1
|
|
|
|
iscsiadm -m discovery -t sendtargets -p $TARGET_IP:$ISCSI_PORT
|
|
iscsiadm -m node --login -p $TARGET_IP:$ISCSI_PORT
|
|
|
|
trap "iscsicleanup; killprocess $pid; exit 1" SIGINT SIGTERM EXIT
|
|
|
|
sleep 1
|
|
$fio_py 4096 1 randrw 1 verify
|
|
$fio_py 131072 32 randrw 1 verify
|
|
$fio_py 524288 128 randrw 1 verify
|
|
|
|
if [ $RUN_NIGHTLY -eq 1 ]; then
|
|
$fio_py 4096 1 write 300 verify
|
|
|
|
# Run the running_config test which will generate a config file from the
|
|
# running iSCSI target, then kill and restart the iSCSI target using the
|
|
# generated config file
|
|
running_config
|
|
fi
|
|
|
|
iscsicleanup
|
|
$rpc_py delete_target_node 'iqn.2016-06.io.spdk:Target3'
|
|
|
|
rm -f ./local-job0-0-verify.state
|
|
trap - SIGINT SIGTERM EXIT
|
|
iscsicleanup
|
|
rm -f $testdir/iscsi.conf
|
|
killprocess $pid
|
|
#echo 1 > /sys/bus/pci/rescan
|
|
#sleep 2
|
|
$rootdir/scripts/setup.sh
|
|
|
|
timing_exit fio
|