From patchwork Mon Apr 14 14:05:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 14050492 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C6AF42C2598 for ; Mon, 14 Apr 2025 14:05:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744639557; cv=none; b=A5t/eDzXWChWG6CslnTHxhNaszcVo05EV6esk8jiK4CHuvcgkEq3DDMMElBLmW9i10RYtfyXOtrnuSZd5RjIXv1IqQwQ/xk9PwEEqbUbKTqBIz8uGKix43vfxjs5QqB1/pOCuI5OVHt0yYTiR8wME/065wcEfbZJDgrlSLutx4U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744639557; c=relaxed/simple; bh=pHwq1vbxRUPFEuWb6uI39nP+MWqTRePdK8lKMaNxOC8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Js6bnB9TzC0gmVsmz5xdk0hIaDJhcAcUz+k7YE05z+QYKPMMuCIkXitZ7doiOWVjwec6g9X/pssEJ3WpDfpgzueFkL6sVT/tuGYdB8sVKW7+iOZ9/IbRRF663o2aa6MiZDg77BlM1vY90Xef0mk2pgp+CIiZ4MLDdGe5vzmM0SU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dckQOyrq; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dckQOyrq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8934C4CEE2; Mon, 14 Apr 2025 14:05:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1744639556; bh=pHwq1vbxRUPFEuWb6uI39nP+MWqTRePdK8lKMaNxOC8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=dckQOyrqSjip+KABkMvpTqAbzTsi7BsDZLMTT44YncFbBKRpPkocR2JCtklcwDmn8 jIhLSdkQTr0wiAkVT+Hn5s1pe9dcN8qZSczqZicvyF8y74/amzgSB+WL7X3FwImGhe csORJg/D4h1AIIWg/Sg3XJVXria7+1lKSk4ztzUnco8aIHtMP6OT2w88P4HdLoexMt Wvjhr3eSQemZ0ktfwZpi+7mJODofUhH4yuGyiiw8L3Y7SVi5C8TI1yCAofV/kjyWD2 KUeZRe3zkJakYXeR4JR6VT+FYGFXttj45W1QCh+K0jZFdTJiuryHDlDwlLEYbXVNG9 v+2p4TKrscE9A== From: Daniel Wagner Date: Mon, 14 Apr 2025 16:05:50 +0200 Subject: [PATCH blktests v3 1/4] common/nvme: add debug nvmet path variable Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250414-test-target-v3-1-024575fcec06@kernel.org> References: <20250414-test-target-v3-0-024575fcec06@kernel.org> In-Reply-To: <20250414-test-target-v3-0-024575fcec06@kernel.org> To: Shin'ichiro Kawasaki Cc: Chaitanya Kulkarni , linux-block@vger.kernel.org, Daniel Wagner X-Mailer: b4 0.14.2 Reviewed-by: Chaitanya Kulkarni Signed-off-by: Daniel Wagner --- common/nvme | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/nvme b/common/nvme index 3761329d39e3763136f60a4751ad15de347f6e9b..04b49c2c1f9edc6de516398b537502fc30a92969 100644 --- a/common/nvme +++ b/common/nvme @@ -26,6 +26,8 @@ nvmet_blkdev_type=${nvmet_blkdev_type:-"device"} NVMET_BLKDEV_TYPES=${NVMET_BLKDEV_TYPES:-"device file"} nvme_target_control="${NVME_TARGET_CONTROL:-}" NVMET_CFS="/sys/kernel/config/nvmet/" +# shellcheck disable=SC2034 +NVMET_DFS="/sys/kernel/debug/nvmet/" nvme_trtype=${nvme_trtype:-} nvme_adrfam=${nvme_adrfam:-} From patchwork Mon Apr 14 14:05:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 14050493 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 53E662D0A43 for ; Mon, 14 Apr 2025 14:05:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744639559; cv=none; b=n5ECsmyVBdF675iPVmeQSxZJOcuPk/LfxFYUqclygaisoN87WlpZcFkZiHmfjHpzbY7XEOXSA+PrDySzKJqWEojkNeYRyuDirARicGEu9AqZXBFnBvupuXtup76eoLjYUuwerjl6zUF5n387YRJ6wjlknURTmctIDa0e90f6gE8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744639559; c=relaxed/simple; bh=YFoXgbgup6mavWMsiZOhhOvd8aBFDXaX4CBB6vu+uao=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XN5Y8PbfJgxKPa8A1FcuFpn6atxgmuQcclW0lfBTAYoStgCDOaFr9IUQFr6nOGfpUzmHQS1yT/J0N/Xa3L3V0hDAr7BGWWZEViOQ0TUmmWuKLtCRQu5XluvLuELW1+93LL2bdow8ljWA8NCmtMMTVAT5FxQ3a1QdGN2FauojFrU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HzAJ4eI3; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HzAJ4eI3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6ECAEC4CEE2; Mon, 14 Apr 2025 14:05:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1744639558; bh=YFoXgbgup6mavWMsiZOhhOvd8aBFDXaX4CBB6vu+uao=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=HzAJ4eI3BxvxWzbE3hCDKbSQ/8yHSoj45fLyzNLUWClbkoV2FhFJQLSxa9IF4ycaz ydC/FPCIqXMG8/bmVUTVGIDKgAYYfX18TitWNg2iWrMu8YiIVxE0IVCbzpTboWmx9D ti5BldvAI4wpGEaBBdTMkw3njeNEfzOD/NwGgY2YyNiNlkD3ZzbUA1165tZTpD3Fhr 3IGKk0YAwZ+C6mw6UXbIm4yjKic9EhZiC3dZ3bvxiMZMOdgU/ZgFbUcm7XRZyFliYT M0Au/AV1wX+8emZyN4iJXWxT6bJ8IEbkGl4IoHha0WsaltRV5PX01GT7D3C/iiJftL Iy/y1kXvugqfw== From: Daniel Wagner Date: Mon, 14 Apr 2025 16:05:51 +0200 Subject: [PATCH blktests v3 2/4] common/nvme: move nvmf_wait_for_state to common code Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250414-test-target-v3-2-024575fcec06@kernel.org> References: <20250414-test-target-v3-0-024575fcec06@kernel.org> In-Reply-To: <20250414-test-target-v3-0-024575fcec06@kernel.org> To: Shin'ichiro Kawasaki Cc: Chaitanya Kulkarni , linux-block@vger.kernel.org, Daniel Wagner X-Mailer: b4 0.14.2 In preperation to add another tests which needs the nvmf_wait_for_state function, move it to the common code base. Signed-off-by: Daniel Wagner --- common/nvme | 27 +++++++++++++++++++++++++++ tests/nvme/048 | 31 ++----------------------------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/common/nvme b/common/nvme index 04b49c2c1f9edc6de516398b537502fc30a92969..68720ddc20cf3ed5cfe2841f9921321d9899ce0d 100644 --- a/common/nvme +++ b/common/nvme @@ -573,6 +573,33 @@ _nvmf_wait_for_ns() { return 0 } +_nvmf_wait_for_state() { + local def_state_timeout=5 + local subsys_name="$1" + local state="$2" + local timeout="${3:-$def_state_timeout}" + local nvmedev + local state_file + local start_time + local end_time + + nvmedev=$(_find_nvme_dev "${subsys_name}") + state_file="/sys/class/nvme-fabrics/ctl/${nvmedev}/state" + + start_time=$(date +%s) + while ! grep -q "${state}" "${state_file}"; do + sleep 1 + end_time=$(date +%s) + if (( end_time - start_time > timeout )); then + echo "expected state \"${state}\" not " \ + "reached within ${timeout} seconds" + return 1 + fi + done + + return 0 +} + _create_nvmet_ns() { local subsysnqn="${def_subsysnqn}" local nsid="${def_nsid}" diff --git a/tests/nvme/048 b/tests/nvme/048 index bd41faef4e5431957f63184408c147b8ada1a8dd..afd9272c1a31b5a3d2df2e1ce9fe3268de768420 100755 --- a/tests/nvme/048 +++ b/tests/nvme/048 @@ -19,33 +19,6 @@ set_conditions() { _set_nvme_trtype "$@" } -nvmf_wait_for_state() { - local def_state_timeout=5 - local subsys_name="$1" - local state="$2" - local timeout="${3:-$def_state_timeout}" - local nvmedev - local state_file - local start_time - local end_time - - nvmedev=$(_find_nvme_dev "${subsys_name}") - state_file="/sys/class/nvme-fabrics/ctl/${nvmedev}/state" - - start_time=$(date +%s) - while ! grep -q "${state}" "${state_file}"; do - sleep 1 - end_time=$(date +%s) - if (( end_time - start_time > timeout )); then - echo "expected state \"${state}\" not " \ - "reached within ${timeout} seconds" - return 1 - fi - done - - return 0 -} - nvmf_check_queue_count() { local subsys_name="$1" local queue_count="$2" @@ -87,7 +60,7 @@ set_qid_max() { set_nvmet_attr_qid_max "${subsys_name}" "${qid_max}" nvmf_check_queue_count "${subsys_name}" "${qid_max}" || return 1 - nvmf_wait_for_state "${subsys_name}" "live" || return 1 + _nvmf_wait_for_state "${subsys_name}" "live" || return 1 return 0 } @@ -106,7 +79,7 @@ test() { _nvme_connect_subsys --keep-alive-tmo 1 \ --reconnect-delay 2 - if ! nvmf_wait_for_state "${def_subsysnqn}" "live" ; then + if ! _nvmf_wait_for_state "${def_subsysnqn}" "live" ; then echo FAIL else set_qid_max "${def_subsysnqn}" 1 || echo FAIL From patchwork Mon Apr 14 14:05:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 14050494 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5DA52D0A49 for ; Mon, 14 Apr 2025 14:06:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744639561; cv=none; b=oQpFJZWU0gC78xMh0wOdJGApdK/rqpp7dcIdHiJLF9EnTu2vSN0voIPJlR+OCifhOzJ3Q9VUlyZd9OTbWur5FaLcXNlxR6P1OAVjkVb71FmE0qRsumLnSJ/jG9aF1b+gXO0mHrKsF9dc6M71ObRjyE3PQVkEHoNbYZBEKoswX7k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744639561; c=relaxed/simple; bh=VGqSKjU88+1/Ydy9B6Q8Gcc0hdB/mx7qO+/1X8xaFBg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=S2qsZXrvZXm4yfNpfy8WREYkwkUVTwzF//D1UuvtjzW2KUH8ejpPyOVfoJzCTgGpIzIJBl2Mx7cJIgXTffR1mCOZc/ywiMYdyQZeUTXAy7ypUtZNf+WiXN0OXfBrdnFtjHsHyH9BHNSRQGVnXlnS/EjgQ6D56933w1tXciJfAm4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Vm0o7uEf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Vm0o7uEf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EDB71C4CEE9; Mon, 14 Apr 2025 14:06:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1744639561; bh=VGqSKjU88+1/Ydy9B6Q8Gcc0hdB/mx7qO+/1X8xaFBg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Vm0o7uEfJ3vL6H3+dW5mCmNieGSWca1xAlVBV8PI48PJ4GPgtnRCD3P7eBzLZOphc TpD3HRe07+wVeK7USur3omc2l5T+H1ZqpQMUa5slBwC0KMnJ7JX9XQlDGN0Uq/9cKh SFGsB7vNSt9UkbvIUqc5mIxltwZPW7xV9W8M2gTijB4eH+3vrSi5u9gC1nR1SN8ewV xuEMRFc7mTzF0/+17uF5urQ6XKrNEvsJBWImobd5/j/ZEEtjjlwD0nc8CMX3FcULoY ojVxq/v0RwMqY5Wdbh1KTSs2IuF9mfpacE73fuGGOM1Bvu7gfZ5tjtbarVfzENdIiM MX+wOmOmiiXhw== From: Daniel Wagner Date: Mon, 14 Apr 2025 16:05:52 +0200 Subject: [PATCH blktests v3 3/4] nvme/060: add test nvme fabrics target resetting during I/O Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250414-test-target-v3-3-024575fcec06@kernel.org> References: <20250414-test-target-v3-0-024575fcec06@kernel.org> In-Reply-To: <20250414-test-target-v3-0-024575fcec06@kernel.org> To: Shin'ichiro Kawasaki Cc: Chaitanya Kulkarni , linux-block@vger.kernel.org, Daniel Wagner X-Mailer: b4 0.14.2 Newer kernel support to reset the target via the debugfs. Add a new test case which exercises this interface. Reviewed-by: Chaitanya Kulkarni Signed-off-by: Daniel Wagner --- tests/nvme/060 | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/nvme/060.out | 2 ++ 2 files changed, 64 insertions(+) diff --git a/tests/nvme/060 b/tests/nvme/060 new file mode 100755 index 0000000000000000000000000000000000000000..aa048198708cc82e684aaf94c145ae88c4af3099 --- /dev/null +++ b/tests/nvme/060 @@ -0,0 +1,62 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2025 Daniel Wagner, SUSE Labs +# +# Test nvme fabrics controller reset/disconnect/reconnect. + +. tests/nvme/rc + +DESCRIPTION="test nvme fabrics target reset" + +requires() { + _nvme_requires + _have_loop + _require_nvme_trtype tcp rdma fc + _have_kernel_option NVME_TARGET_DEBUGFS +} + +set_conditions() { + _set_nvme_trtype "$@" +} + +nvmet_debug_trigger_reset() { + local nvmet_subsystem="$1" + local dfs_path="${NVMET_DFS}/${nvmet_subsystem}" + + find "${dfs_path}" -maxdepth 1 -type d -name 'ctrl*' -exec sh -c 'echo "fatal" > "$1/state"' _ {} \; +} + +nvmet_reset_loop() { + while true; do + nvmet_debug_trigger_reset "${def_subsysnqn}" + sleep 2 + done +} + +test() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + + _nvmet_target_setup + + nvmet_reset_loop & + reset_loop_pid=$! + + # Reset the host in different states e.g when the host is in the + # connected or connecting state. + # + # The target reset is triggered with an even number timeout, while the + # host reconnects with an odd number timeout. + for ((i = 0; i <= 5; i++)); do + _nvme_connect_subsys --keep-alive-tmo 1 --reconnect-delay 1 + sleep 3 + _nvme_disconnect_subsys >> "$FULL" 2>&1 + done + + { kill "${reset_loop_pid}"; wait; } &> /dev/null + + _nvmet_target_cleanup + + echo "Test complete" +} diff --git a/tests/nvme/060.out b/tests/nvme/060.out new file mode 100644 index 0000000000000000000000000000000000000000..517ff2dfcfd41c4088991e669af9fef52bde570b --- /dev/null +++ b/tests/nvme/060.out @@ -0,0 +1,2 @@ +Running nvme/060 +Test complete From patchwork Mon Apr 14 14:05:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 14050495 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3E7022D0A54 for ; Mon, 14 Apr 2025 14:06:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744639564; cv=none; b=D/P1QW2xaWT2UxawZ6VWVmgHW9fHIpp9uct4Cbl6lUNe31LpQ5MmfegDMF7yRaAOmbnz+l9k71q+YuFkqVk573nqQR/UxzE08ulmdS3VZnX3a/aKjV5zxCKS0JuGsPetaDkdchVch4IZh5u/Y8vJ+wlDVRfYR/aWmS9QrsDQc7k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744639564; c=relaxed/simple; bh=7Sv5aVE5FdxcIGCABFX+xyDVu2hjevPjbLV0GYczMcw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XZyLJ2AYYBgwo1i0C+7kMdCuSHA4pCq1lyq+r5enC1f7NvIDK09vTcC1eNfOD6P3RF7dUZrqBZxyhHLCih0TnZfxdrAsWu9DHoCsO4gg+7/QBSSrkTy+cIvz3QxjZ36txwwAXs44rR7A+gUoj+mtfqhugWdq3k1OFTjPK6t/b3U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=a3RUhNSR; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="a3RUhNSR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F68DC4CEE2; Mon, 14 Apr 2025 14:06:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1744639563; bh=7Sv5aVE5FdxcIGCABFX+xyDVu2hjevPjbLV0GYczMcw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=a3RUhNSRbTQn3B2Jd8P8KMmK+APQFaa2WnHEQY19PKk9cwIavICyY+jcIWobNkO+5 PmXV8Xed6AZhCRq2zndtrq0Rrw2ZEhffWG0MtWs1Igm+XUHDrqFXUzUIficNthTVKl sQE/v5lAIwpflGxLh5fjhE4IhfV+O41w/bxa3kYwtZxfd0GXmZ2+XiulbMqZ3iQR3z 1jUAQy4hNJoaKGU5LKVuZzxeoJixD6LZ2x59pncuG7CE2Pws54Sjgu9TUgwfoEFMUl 0fxjW3BtuW/DsMc5huk2GRGQGXA70sw9fFIRqGWvfuOJCysl+IQegM6tecBFosHMx8 7zpoiWreSQhZw== From: Daniel Wagner Date: Mon, 14 Apr 2025 16:05:53 +0200 Subject: [PATCH blktests v3 4/4] nvme/061: add test teardown and setup fabrics target during I/O Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250414-test-target-v3-4-024575fcec06@kernel.org> References: <20250414-test-target-v3-0-024575fcec06@kernel.org> In-Reply-To: <20250414-test-target-v3-0-024575fcec06@kernel.org> To: Shin'ichiro Kawasaki Cc: Chaitanya Kulkarni , linux-block@vger.kernel.org, Daniel Wagner X-Mailer: b4 0.14.2 Add a new test case which forcefully removes the target and setup it again. Reviewed-by: Chaitanya Kulkarni Signed-off-by: Daniel Wagner --- tests/nvme/061 | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/nvme/061.out | 21 +++++++++++++++++ 2 files changed, 87 insertions(+) diff --git a/tests/nvme/061 b/tests/nvme/061 new file mode 100755 index 0000000000000000000000000000000000000000..c22046a6f547ea3325e2f5bdd6fed807f445391d --- /dev/null +++ b/tests/nvme/061 @@ -0,0 +1,66 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2025 Daniel Wagner, SUSE Labs +# +# Test if the host keeps running IO when the target is forcefully removed and +# added back. + +. tests/nvme/rc + +DESCRIPTION="test fabric target teardown and setup during I/O" +TIMED=1 + +requires() { + _nvme_requires + _have_loop + _have_fio + _require_nvme_trtype tcp rdma fc +} + +set_conditions() { + _set_nvme_trtype "$@" +} + +test() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + + local ns + + _nvmet_target_setup + + _nvme_connect_subsys --keep-alive-tmo 1 --reconnect-delay 1 + + ns=$(_find_nvme_ns "${def_subsys_uuid}") + + _run_fio_rand_io --filename="/dev/${ns}" \ + --group_reporting \ + --time_based --runtime=1d &> /dev/null & + fio_pid=$! + sleep 1 + + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") + state_file="/sys/class/nvme-fabrics/ctl/${nvmedev}/state" + for ((i = 0; i <= 5; i++)); do + echo "iteration $i" + + _nvmet_target_cleanup + + _nvmf_wait_for_state "${def_subsysnqn}" "connecting" || return 1 + echo "state: $(cat "${state_file}")" + + _nvmet_target_setup + + _nvmf_wait_for_state "${def_subsysnqn}" "live" || return 1 + echo "state: $(cat "${state_file}")" + done + + { kill "${fio_pid}"; wait; } &> /dev/null + + _nvme_disconnect_subsys + + _nvmet_target_cleanup + + echo "Test complete" +} diff --git a/tests/nvme/061.out b/tests/nvme/061.out new file mode 100644 index 0000000000000000000000000000000000000000..75516abdac005854c2be165005c076ef8891c518 --- /dev/null +++ b/tests/nvme/061.out @@ -0,0 +1,21 @@ +Running nvme/061 +iteration 0 +state: connecting +state: live +iteration 1 +state: connecting +state: live +iteration 2 +state: connecting +state: live +iteration 3 +state: connecting +state: live +iteration 4 +state: connecting +state: live +iteration 5 +state: connecting +state: live +disconnected 1 controller(s) +Test complete