From patchwork Thu Aug 27 19:49:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 11741747 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5A09114E5 for ; Thu, 27 Aug 2020 19:49:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 41AC82087E for ; Thu, 27 Aug 2020 19:49:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=deltatee.com header.i=@deltatee.com header.b="K3zwFSdp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727944AbgH0TtS (ORCPT ); Thu, 27 Aug 2020 15:49:18 -0400 Received: from ale.deltatee.com ([204.191.154.188]:54800 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727931AbgH0TtR (ORCPT ); Thu, 27 Aug 2020 15:49:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ZuicSm34YejEE0eYQsfa57VxPlQPE4+0WlherfvxsyY=; b=K3zwFSdpi+sNp9EvmxJGyYRyID aRE8er6H0th6u20yWnTfugyhVL3pJE4qLP2eWR4ghFDv+/skpzPExV+pX6G+lfsMrAAKG+W0veK/f upGtLxTJhaKT4ejy83VQNezFF0hy2XNWfjH/uNAeDj/WRCQ3otFmCZKMC0WbfwsJftpYygdnGSO8r yNFWCMvLyvAPsczuozMnyHYqOrGR6HUwscOjrg7cPQYAhiILdyacflIwqbGvUyXbM9tvYZkef6b2D yx2/NnKZB2Q39lxwxjR7pkXm8yKqqmNT+KpLYOKCPGDIq7Bp5m+1ZS39GLy4gmo/FNfBnZgBuOhFB FWGkHsLw==; Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kBNta-0000Cd-Tu; Thu, 27 Aug 2020 13:49:16 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.92) (envelope-from ) id 1kBNtZ-0001bt-NS; Thu, 27 Aug 2020 13:49:13 -0600 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, Omar Sandoval Cc: Sagi Grimberg , Chaitanya Kulkarni , Stephen Bates , Logan Gunthorpe Date: Thu, 27 Aug 2020 13:49:02 -0600 Message-Id: <20200827194912.6135-2-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200827194912.6135-1-logang@deltatee.com> References: <20200827194912.6135-1-logang@deltatee.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, osandov@osandov.com, sagi@grimberg.me, Chaitanya.Kulkarni@wdc.com, sbates@raithlin.com, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-6.7 required=5.0 tests=ALL_TRUSTED,BAYES_00, MYRULES_NO_TEXT,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Subject: [PATCH blktests 01/11] common/fio: Remove state file in common helper X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Instead of each individual test removing this file, just do it in the common helper. Signed-off-by: Logan Gunthorpe Reviewed-by: Chaitanya Kulkarni --- common/fio | 1 + tests/nvme/010 | 1 - tests/nvme/011 | 1 - tests/nvme/012 | 1 - tests/nvme/013 | 1 - 5 files changed, 1 insertion(+), 4 deletions(-) diff --git a/common/fio b/common/fio index 8bfad4238dda..94c65c107a14 100644 --- a/common/fio +++ b/common/fio @@ -181,6 +181,7 @@ _run_fio_rand_io() { _run_fio_verify_io() { _run_fio --name=verify --rw=randwrite --direct=1 --ioengine=libaio --bs=4k \ --iodepth=16 --verify=crc32c "$@" + rm -f local*verify*state } _fio_perf_report() { diff --git a/tests/nvme/010 b/tests/nvme/010 index 2ed0f4871a30..25c79089e092 100755 --- a/tests/nvme/010 +++ b/tests/nvme/010 @@ -51,7 +51,6 @@ test() { losetup -d "${loop_dev}" rm "${file_path}" - rm -f local*verify*state echo "Test complete" } diff --git a/tests/nvme/011 b/tests/nvme/011 index 974b33745b99..ad360d095ffc 100755 --- a/tests/nvme/011 +++ b/tests/nvme/011 @@ -47,7 +47,6 @@ test() { _remove_nvmet_port "${port}" rm "${file_path}" - rm -f local-write-and-verify*state echo "Test complete" } diff --git a/tests/nvme/012 b/tests/nvme/012 index 27981e903c58..dc86ee647729 100755 --- a/tests/nvme/012 +++ b/tests/nvme/012 @@ -61,7 +61,6 @@ test() { losetup -d "${loop_dev}" - rm -f local*verify*state rm "${file_path}" rm -fr "${mount_dir}" diff --git a/tests/nvme/013 b/tests/nvme/013 index af5f3730a2fc..0ed52926363a 100755 --- a/tests/nvme/013 +++ b/tests/nvme/013 @@ -57,7 +57,6 @@ test() { _remove_nvmet_subsystem "${subsys_name}" _remove_nvmet_port "${port}" - rm -f local*verify*state rm "${file_path}" rm -fr "${mount_dir}" From patchwork Thu Aug 27 19:49:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 11741777 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5B7B114E5 for ; Thu, 27 Aug 2020 19:50:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3E2AD207F7 for ; Thu, 27 Aug 2020 19:50:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=deltatee.com header.i=@deltatee.com header.b="tPoyX7LB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727961AbgH0TtT (ORCPT ); Thu, 27 Aug 2020 15:49:19 -0400 Received: from ale.deltatee.com ([204.191.154.188]:54792 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727930AbgH0TtR (ORCPT ); Thu, 27 Aug 2020 15:49:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=T2/WWXhmesEttKgAkD/m71X8OynQjfURTrXfzc8i8WQ=; b=tPoyX7LBneOCOkyMdOq4SKMsX6 QcY9nftn2g//8rXYw7GJw0gf0+TsfLc5f9X9wvu7BxVbZk9dIA63DyN3zNSC6z/DmHQ+vKvRm/RBH uN4+mCDhXbrnhoBck7eOsDaBmrTTsag9KIK6DIbzU+HVZAbwRU/N2trZQ6WL+vUuShuARehPTBBI7 zSmDr/SOSC0ol2ialz0Aei/XjYw8fQq8p6yJcgP3ir/G3UoTe53go+EEHDhUXUJok+hJEIq7w1MJT nagPMnqCrcpzqU7kGGe+YyaOvDTh/ugdxHFcyZRZL5bou3OpN/WJnXmLLx4Hy2koORRKAAYVA0ACO IgAztFIQ==; Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kBNta-0000Ce-Tv; Thu, 27 Aug 2020 13:49:15 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.92) (envelope-from ) id 1kBNtZ-0001bw-RV; Thu, 27 Aug 2020 13:49:13 -0600 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, Omar Sandoval Cc: Sagi Grimberg , Chaitanya Kulkarni , Stephen Bates , Logan Gunthorpe Date: Thu, 27 Aug 2020 13:49:03 -0600 Message-Id: <20200827194912.6135-3-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200827194912.6135-1-logang@deltatee.com> References: <20200827194912.6135-1-logang@deltatee.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, osandov@osandov.com, sagi@grimberg.me, Chaitanya.Kulkarni@wdc.com, sbates@raithlin.com, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-6.7 required=5.0 tests=ALL_TRUSTED,BAYES_00, MYRULES_NO_TEXT,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Subject: [PATCH blktests 02/11] common/xfs: Create common helper to check for XFS support X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Two nvme tests create and mount XFS filesystems and check for mkfs.xfs. They should also check for XFS support in the kernel so create a common helper for this. Signed-off-by: Logan Gunthorpe --- common/rc | 8 ++++++++ common/xfs | 11 +++++++++++ tests/nvme/012 | 3 ++- tests/nvme/013 | 3 ++- 4 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 common/xfs diff --git a/common/rc b/common/rc index 7f02103dc786..3dd1ab76f737 100644 --- a/common/rc +++ b/common/rc @@ -181,6 +181,14 @@ _have_tracepoint() { return 0 } +_have_fs() { + modprobe "$1" >/dev/null 2>&1 + if [[ ! -d "/sys/fs/$1" ]]; then + SKIP_REASON="kernel does not support filesystem $1" + return 1 + fi +} + _test_dev_is_rotational() { [[ $(cat "${TEST_DEV_SYSFS}/queue/rotational") -ne 0 ]] } diff --git a/common/xfs b/common/xfs new file mode 100644 index 000000000000..d1a603b8c7b5 --- /dev/null +++ b/common/xfs @@ -0,0 +1,11 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2017 Omar Sandoval +# +# fio helper functions. + +. common/shellcheck + +_have_xfs() { + _have_fs xfs && _have_program mkfs.xfs +} diff --git a/tests/nvme/012 b/tests/nvme/012 index dc86ee647729..981e7779e21d 100755 --- a/tests/nvme/012 +++ b/tests/nvme/012 @@ -5,12 +5,13 @@ # Test mkfs with data verification for block device backed ns. . tests/nvme/rc +. common/xfs DESCRIPTION="run mkfs and data verification fio job on NVMeOF block device-backed ns" TIMED=1 requires() { - _have_program nvme && _have_program mkfs.xfs && _have_program fio && \ + _have_program nvme && _have_xfs && _have_program fio && \ _have_modules loop nvme-loop nvmet && _have_configfs } diff --git a/tests/nvme/013 b/tests/nvme/013 index 0ed52926363a..228fab9ff02b 100755 --- a/tests/nvme/013 +++ b/tests/nvme/013 @@ -5,12 +5,13 @@ # Test mkfs with data verification for file backed ns. . tests/nvme/rc +. common/xfs DESCRIPTION="run mkfs and data verification fio job on NVMeOF file-backed ns" TIMED=1 requires() { - _have_program nvme && _have_program mkfs.xfs && _have_fio && \ + _have_program nvme && _have_xfs && _have_fio && \ _have_modules nvme-loop nvmet && _have_configfs } From patchwork Thu Aug 27 19:49:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 11741745 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 834EE16B1 for ; Thu, 27 Aug 2020 19:49:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 633DB22B4D for ; Thu, 27 Aug 2020 19:49:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=deltatee.com header.i=@deltatee.com header.b="PfEZncNM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727839AbgH0TtS (ORCPT ); Thu, 27 Aug 2020 15:49:18 -0400 Received: from ale.deltatee.com ([204.191.154.188]:54790 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726120AbgH0TtR (ORCPT ); Thu, 27 Aug 2020 15:49:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=TbglSCmtcusKByd+MVC/aRpDHF4BLLRY+0AJcHvM4e4=; b=PfEZncNMyEFbJJQZktuy1vbXxm aFfLZMEV4uilkjxs7kqcPybdXN1QNK4SIjXG3XvFdkoE9/vhxIYdoAYs08nuhk9FpAKjjYeEg9xdQ j3+FPqYBSYECt3UnSwhsdnz+mkG4k9mS0/HM5BGdqdI1GXW2JO7BxZpkuVqThdSwZ2kV7NMaZMLwV MecavZXVH5JFdR2Yza8ehuvgo8XAKhQLydo4yI6kxgUT+TeP5mqYTQuMDgPqecBz4U1+GOUh3uKxs m1Ti2iMOy6l5+S0XC3RC28fsEtVvT7J4cEvHEO9DWQCOmN/PYiQK16A+eFylAT4BS35MvbBdlf7RQ /9rN+m/A==; Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kBNta-0000Cf-Tu; Thu, 27 Aug 2020 13:49:15 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.92) (envelope-from ) id 1kBNtZ-0001bz-VJ; Thu, 27 Aug 2020 13:49:13 -0600 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, Omar Sandoval Cc: Sagi Grimberg , Chaitanya Kulkarni , Stephen Bates , Logan Gunthorpe Date: Thu, 27 Aug 2020 13:49:04 -0600 Message-Id: <20200827194912.6135-4-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200827194912.6135-1-logang@deltatee.com> References: <20200827194912.6135-1-logang@deltatee.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, osandov@osandov.com, sagi@grimberg.me, Chaitanya.Kulkarni@wdc.com, sbates@raithlin.com, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-6.7 required=5.0 tests=ALL_TRUSTED,BAYES_00, MYRULES_NO_TEXT,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Subject: [PATCH blktests 03/11] common/xfs: Create common helper to verify block device with xfs X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Make a common helper from the code in tests nvme/012 and nvme/013 to run an fio verify on a XFS file system backed by the specified block device. While we are at it, all the output is redirected to $FULL instead of /dev/null. Signed-off-by: Logan Gunthorpe --- common/xfs | 22 ++++++++++++++++++++++ tests/nvme/012 | 14 +------------- tests/nvme/013 | 14 +------------- 3 files changed, 24 insertions(+), 26 deletions(-) diff --git a/common/xfs b/common/xfs index d1a603b8c7b5..210c924cdd41 100644 --- a/common/xfs +++ b/common/xfs @@ -9,3 +9,25 @@ _have_xfs() { _have_fs xfs && _have_program mkfs.xfs } + +_xfs_mkfs_and_mount() { + local bdev=$1 + local mount_dir=$2 + + mkdir -p "${mount_dir}" + umount "${mount_dir}" + mkfs.xfs -l size=32m -f "${bdev}" + mount "${bdev}" "${mount_dir}" +} + +_xfs_run_fio_verify_io() { + local mount_dir="/mnt/blktests" + local bdev=$1 + + _xfs_mkfs_and_mount "${bdev}" "${mount_dir}" >> "${FULL}" 2>&1 + + _run_fio_verify_io --size=950m --directory="${mount_dir}/" + + umount "${mount_dir}" >> "${FULL}" 2>&1 + rm -fr "${mount_dir}" +} diff --git a/tests/nvme/012 b/tests/nvme/012 index 981e7779e21d..1dae795d17ac 100755 --- a/tests/nvme/012 +++ b/tests/nvme/012 @@ -23,12 +23,9 @@ test() { local port local nvmedev local loop_dev - local mount_dir="/mnt/blktests" local file_path="${TMPDIR}/img" local subsys_name="blktests-subsystem-1" - mkdir -p "${mount_dir}" > /dev/null 2>&1 - truncate -s 1G "${file_path}" loop_dev="$(losetup -f --show "${file_path}")" @@ -44,15 +41,7 @@ test() { cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" - umount ${mount_dir} > /dev/null 2>&1 - - mkfs.xfs -l size=32m -f /dev/"${nvmedev}n1" > /dev/null 2>&1 - - mount /dev/"${nvmedev}n1" "${mount_dir}" - - _run_fio_verify_io --size=950m --directory="${mount_dir}/" - - umount "${mount_dir}" > /dev/null 2>&1 + _xfs_run_fio_verify_io "/dev/${nvmedev}n1" nvme disconnect -n "${subsys_name}" @@ -63,7 +52,6 @@ test() { losetup -d "${loop_dev}" rm "${file_path}" - rm -fr "${mount_dir}" echo "Test complete" } diff --git a/tests/nvme/013 b/tests/nvme/013 index 228fab9ff02b..c7b0f16ef504 100755 --- a/tests/nvme/013 +++ b/tests/nvme/013 @@ -22,13 +22,10 @@ test() { local port local nvmedev - local mount_dir="/mnt/blktests/" local file_path="${TMPDIR}/img" local subsys_name="blktests-subsystem-1" - mkdir -p "${mount_dir}" > /dev/null 2>&1 - truncate -s 1G "${file_path}" _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ @@ -42,15 +39,7 @@ test() { cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" - umount ${mount_dir} > /dev/null 2>&1 - - mkfs.xfs -l size=32m -f /dev/"${nvmedev}n1" > /dev/null 2>&1 - - mount /dev/"${nvmedev}n1" "${mount_dir}" - - _run_fio_verify_io --size=800m --directory="${mount_dir}/" - - umount "${mount_dir}" > /dev/null 2>&1 + _xfs_run_fio_verify_io "/dev/${nvmedev}n1" nvme disconnect -n "${subsys_name}" @@ -59,7 +48,6 @@ test() { _remove_nvmet_port "${port}" rm "${file_path}" - rm -fr "${mount_dir}" echo "Test complete" } From patchwork Thu Aug 27 19:49:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 11741779 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EFB2516B1 for ; Thu, 27 Aug 2020 19:50:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C3A6B22BEA for ; Thu, 27 Aug 2020 19:50:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=deltatee.com header.i=@deltatee.com header.b="Xs4cqqnI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727952AbgH0TtT (ORCPT ); Thu, 27 Aug 2020 15:49:19 -0400 Received: from ale.deltatee.com ([204.191.154.188]:54804 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727932AbgH0TtR (ORCPT ); Thu, 27 Aug 2020 15:49:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=XImuR7L+3/WKl3KBtMcLmfV9ts5RH84zlT128RPd+rU=; b=Xs4cqqnIE59fD0G4CxKxNq7UNW EML9iJ1kV2crjguvRbTpfN0Bfp8HclSVN7uvK4+hpzrJw9gCgv8s/bSwcSzaPELKLE+OUcpcZgkWR 5rgeOSc5KbIfqQG7t5YfzCvBglG9opePnOepi90rr8qwhmjV59VDiXWXpKbtV2PNIyI1yLA/KFbxc QW6XPw9V6fCjremy9fg2lBYOALpWNSRSRB0TSt5EyobKjzpdAjJzk8oVvwmJsdj7FCDH4/KIOQELk XikT7at+frWRFSLdSPhn7a+1k8Rvh39FHTrOBtNKZTeSzH9pUF440uBzDPSMcn2Q9jBdIz+FPdRdk SQzbxZ4A==; Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kBNta-0000Cg-Tu; Thu, 27 Aug 2020 13:49:16 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.92) (envelope-from ) id 1kBNta-0001c2-2J; Thu, 27 Aug 2020 13:49:14 -0600 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, Omar Sandoval Cc: Sagi Grimberg , Chaitanya Kulkarni , Stephen Bates , Logan Gunthorpe Date: Thu, 27 Aug 2020 13:49:05 -0600 Message-Id: <20200827194912.6135-5-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200827194912.6135-1-logang@deltatee.com> References: <20200827194912.6135-1-logang@deltatee.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, osandov@osandov.com, sagi@grimberg.me, Chaitanya.Kulkarni@wdc.com, sbates@raithlin.com, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-6.7 required=5.0 tests=ALL_TRUSTED,BAYES_00, MYRULES_NO_TEXT,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Subject: [PATCH blktests 04/11] nvme: Search for specific subsysnqn in _find_nvme_loop_dev X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org This ensures we find the correct nvme loop device if others exist on a given system (which is generally not expected on test systems). Additionally, this will be required in the upcomming test nvme/036 which will have controllers racing with ones being destroyed. Signed-off-by: Logan Gunthorpe --- tests/nvme/004 | 2 +- tests/nvme/005 | 2 +- tests/nvme/008 | 2 +- tests/nvme/009 | 2 +- tests/nvme/010 | 2 +- tests/nvme/011 | 2 +- tests/nvme/012 | 2 +- tests/nvme/013 | 2 +- tests/nvme/014 | 2 +- tests/nvme/015 | 2 +- tests/nvme/018 | 2 +- tests/nvme/019 | 2 +- tests/nvme/020 | 2 +- tests/nvme/021 | 2 +- tests/nvme/022 | 2 +- tests/nvme/023 | 2 +- tests/nvme/024 | 2 +- tests/nvme/025 | 2 +- tests/nvme/026 | 2 +- tests/nvme/027 | 2 +- tests/nvme/028 | 2 +- tests/nvme/029 | 2 +- tests/nvme/rc | 7 ++++--- 23 files changed, 26 insertions(+), 25 deletions(-) diff --git a/tests/nvme/004 b/tests/nvme/004 index 0debcd9c7049..0bda90f60dd2 100755 --- a/tests/nvme/004 +++ b/tests/nvme/004 @@ -35,7 +35,7 @@ test() { nvme connect -t loop -n blktests-subsystem-1 local nvmedev - nvmedev="$(_find_nvme_loop_dev)" + nvmedev=$(_find_nvme_loop_dev "blktests-subsystem-1") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/005 b/tests/nvme/005 index 8c79d234bb1d..82d920596439 100755 --- a/tests/nvme/005 +++ b/tests/nvme/005 @@ -36,7 +36,7 @@ test() { nvme connect -t loop -n blktests-subsystem-1 local nvmedev - nvmedev="$(_find_nvme_loop_dev)" + nvmedev=$(_find_nvme_loop_dev "blktests-subsystem-1") udevadm settle diff --git a/tests/nvme/008 b/tests/nvme/008 index 71ff4d962b00..bd0e2f2e6d5b 100755 --- a/tests/nvme/008 +++ b/tests/nvme/008 @@ -36,7 +36,7 @@ test() { nvme connect -t loop -n "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev=$(_find_nvme_loop_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/009 b/tests/nvme/009 index 25c7da2ab854..9d93888f5c91 100755 --- a/tests/nvme/009 +++ b/tests/nvme/009 @@ -32,7 +32,7 @@ test() { nvme connect -t loop -n "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev=$(_find_nvme_loop_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/010 b/tests/nvme/010 index 25c79089e092..5a47b1f02b35 100755 --- a/tests/nvme/010 +++ b/tests/nvme/010 @@ -36,7 +36,7 @@ test() { nvme connect -t loop -n "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev=$(_find_nvme_loop_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/011 b/tests/nvme/011 index ad360d095ffc..0b1465984dde 100755 --- a/tests/nvme/011 +++ b/tests/nvme/011 @@ -34,7 +34,7 @@ test() { nvme connect -t loop -n "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev=$(_find_nvme_loop_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/012 b/tests/nvme/012 index 1dae795d17ac..fd0bfc491cfa 100755 --- a/tests/nvme/012 +++ b/tests/nvme/012 @@ -37,7 +37,7 @@ test() { nvme connect -t loop -n "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev=$(_find_nvme_loop_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/013 b/tests/nvme/013 index c7b0f16ef504..bed00482f2f5 100755 --- a/tests/nvme/013 +++ b/tests/nvme/013 @@ -35,7 +35,7 @@ test() { nvme connect -t loop -n "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev=$(_find_nvme_loop_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/014 b/tests/nvme/014 index c255d5f12205..96e1dc39407f 100755 --- a/tests/nvme/014 +++ b/tests/nvme/014 @@ -36,7 +36,7 @@ test() { nvme connect -t loop -n "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev=$(_find_nvme_loop_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/015 b/tests/nvme/015 index a8497a2ba400..dc129b6aff36 100755 --- a/tests/nvme/015 +++ b/tests/nvme/015 @@ -32,7 +32,7 @@ test() { nvme connect -t loop -n "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev=$(_find_nvme_loop_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/018 b/tests/nvme/018 index 67d89a6f0b24..9544f0ba0b73 100755 --- a/tests/nvme/018 +++ b/tests/nvme/018 @@ -34,7 +34,7 @@ test() { nvme connect -t loop -n "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev=$(_find_nvme_loop_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/019 b/tests/nvme/019 index a8b0204ec0eb..92dc25fbbd8b 100755 --- a/tests/nvme/019 +++ b/tests/nvme/019 @@ -38,7 +38,7 @@ test() { nvme connect -t loop -n "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev=$(_find_nvme_loop_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/020 b/tests/nvme/020 index b480ee1b92d0..eea19a11b4b3 100755 --- a/tests/nvme/020 +++ b/tests/nvme/020 @@ -34,7 +34,7 @@ test() { nvme connect -t loop -n "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev=$(_find_nvme_loop_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/021 b/tests/nvme/021 index bbee54d16ff1..880ef3df6cdf 100755 --- a/tests/nvme/021 +++ b/tests/nvme/021 @@ -33,7 +33,7 @@ test() { nvme connect -t loop -n "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev=$(_find_nvme_loop_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/022 b/tests/nvme/022 index 9ba07c1cc50f..c6ba18472afc 100755 --- a/tests/nvme/022 +++ b/tests/nvme/022 @@ -33,7 +33,7 @@ test() { nvme connect -t loop -n "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev=$(_find_nvme_loop_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/023 b/tests/nvme/023 index ed2a5ad7653f..9161e81b95e9 100755 --- a/tests/nvme/023 +++ b/tests/nvme/023 @@ -36,7 +36,7 @@ test() { nvme connect -t loop -n "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev=$(_find_nvme_loop_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/024 b/tests/nvme/024 index 538580947c5c..99588b000b30 100755 --- a/tests/nvme/024 +++ b/tests/nvme/024 @@ -33,7 +33,7 @@ test() { nvme connect -t loop -n "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev=$(_find_nvme_loop_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/025 b/tests/nvme/025 index 0039fefa5007..d640e43ac350 100755 --- a/tests/nvme/025 +++ b/tests/nvme/025 @@ -33,7 +33,7 @@ test() { nvme connect -t loop -n "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev=$(_find_nvme_loop_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/026 b/tests/nvme/026 index 7e89d840529c..10488952feb5 100755 --- a/tests/nvme/026 +++ b/tests/nvme/026 @@ -33,7 +33,7 @@ test() { nvme connect -t loop -n "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev=$(_find_nvme_loop_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/027 b/tests/nvme/027 index 4d293beb8b47..47a1ec1c34c0 100755 --- a/tests/nvme/027 +++ b/tests/nvme/027 @@ -33,7 +33,7 @@ test() { nvme connect -t loop -n "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev=$(_find_nvme_loop_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/028 b/tests/nvme/028 index 1280107ed5df..845b52759c6e 100755 --- a/tests/nvme/028 +++ b/tests/nvme/028 @@ -33,7 +33,7 @@ test() { nvme connect -t loop -n "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev=$(_find_nvme_loop_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/029 b/tests/nvme/029 index 65eb40031888..b56c131016c5 100755 --- a/tests/nvme/029 +++ b/tests/nvme/029 @@ -69,7 +69,7 @@ test() { nvme connect -t loop -n "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev=$(_find_nvme_loop_dev "${subsys_name}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/rc b/tests/nvme/rc index 6ffa971b4308..8865d543f4c1 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -162,12 +162,13 @@ _remove_nvmet_subsystem_from_port() { } _find_nvme_loop_dev() { + local subsys=$1 + local subsysnqn local dev - local transport for dev in /sys/class/nvme/nvme*; do dev="$(basename "$dev")" - transport="$(cat "/sys/class/nvme/${dev}/transport")" - if [[ "$transport" == "loop" ]]; then + subsysnqn="$(cat "/sys/class/nvme/${dev}/subsysnqn")" + if [[ "$subsysnqn" == "$subsys" ]]; then echo "$dev" for ((i = 0; i < 10; i++)); do if [[ -e /sys/block/$dev/uuid && From patchwork Thu Aug 27 19:49:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 11741767 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3117F13B6 for ; Thu, 27 Aug 2020 19:50:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 14D9922BEA for ; Thu, 27 Aug 2020 19:50:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=deltatee.com header.i=@deltatee.com header.b="D6qR5M8E" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728138AbgH0TuR (ORCPT ); Thu, 27 Aug 2020 15:50:17 -0400 Received: from ale.deltatee.com ([204.191.154.188]:54896 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727995AbgH0TtW (ORCPT ); Thu, 27 Aug 2020 15:49:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=zXeGK/7+sQwwlqdp4+FvdJPQZh6zoxvuHVtp/tDmIC0=; b=D6qR5M8EB2osdSpNYqcFi5o3JU MiWBaJJIsQ3oOaQbK1roenXRwyCIZvRhk6HZALlSt7juKT1TAFG+z6M7mP64rPJAkQBdEZjzgwNU0 +nxDMf3sEiaxqSaS0bS0CCbPODMtY6v1uhQPCwsCj4kmGQlJ7N4xBL4t4yQ6HfEVrj8muXXqZCyh0 3/RTDnEyAv+Z+Bw4EtLviW0ci5c5QeEHiprb89yh2OudAxWrNORvCk8xEiE8p5pVsZUV+qteFW8K8 13m9ZPfrqFz46urEIgRqmWv/lStAqp2lV7orJna2EtoTpNNlUkgEovB8JtNLCUvmBBmL8bkwif/ap xCyVyQHQ==; Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kBNtg-0000Ce-JP; Thu, 27 Aug 2020 13:49:21 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.92) (envelope-from ) id 1kBNta-0001c5-5n; Thu, 27 Aug 2020 13:49:14 -0600 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, Omar Sandoval Cc: Sagi Grimberg , Chaitanya Kulkarni , Stephen Bates , Logan Gunthorpe Date: Thu, 27 Aug 2020 13:49:06 -0600 Message-Id: <20200827194912.6135-6-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200827194912.6135-1-logang@deltatee.com> References: <20200827194912.6135-1-logang@deltatee.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, osandov@osandov.com, sagi@grimberg.me, Chaitanya.Kulkarni@wdc.com, sbates@raithlin.com, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-6.7 required=5.0 tests=ALL_TRUSTED,BAYES_00, MYRULES_NO_TEXT,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Subject: [PATCH blktests 05/11] nvme: Add common helpers for passthru tests X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Add some simple helpers to setup a passthru target that passes through to a nvme test device. Signed-off-by: Logan Gunthorpe --- tests/nvme/rc | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/tests/nvme/rc b/tests/nvme/rc index 8865d543f4c1..9553dc64b05c 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -24,6 +24,17 @@ _require_test_dev_is_nvme() { return 0 } +_test_dev_nvme_ctrl() { + local dev + + dev=$(cat "${TEST_DEV_SYSFS}/device/dev") + echo "/dev/char/${dev}" +} + +_test_dev_nvme_nsid() { + cat "${TEST_DEV_SYSFS}/nsid" +} + _cleanup_nvmet() { local dev local port @@ -146,6 +157,27 @@ _remove_nvmet_subsystem() { rmdir "${subsys_path}" } +_create_nvmet_passthru() { + local nvmet_subsystem="$1" + local subsys_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}" + local passthru_path="${subsys_path}/passthru" + + mkdir -p "${subsys_path}" + printf 1 > "${subsys_path}/attr_allow_any_host" + + printf "%s" "$(_test_dev_nvme_ctrl)" > "${passthru_path}/device_path" + printf 1 > "${passthru_path}/enable" +} + +_remove_nvmet_passhtru() { + local nvmet_subsystem="$1" + local subsys_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}" + local passthru_path="${subsys_path}/passthru" + + printf 0 > "${passthru_path}/enable" + rmdir "${subsys_path}" +} + _add_nvmet_subsys_to_port() { local port="$1" local nvmet_subsystem="$2" @@ -181,6 +213,55 @@ _find_nvme_loop_dev() { done } +_find_nvme_passthru_loop_dev() { + local subsys=$1 + local nsid + local dev + + dev=$(_find_nvme_loop_dev "${subsys}") + nsid=$(_test_dev_nvme_nsid) + echo "/dev/${dev}n${nsid}" +} + +_nvmet_passthru_target_setup() { + local subsys_name=$1 + + _create_nvmet_passthru "${subsys_name}" + port="$(_create_nvmet_port "loop")" + _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + + echo "$port" +} + +_nvmet_passthru_target_connect() { + local subsys_name=$1 + + nvme connect -t loop -n "${subsys_name}" >>"${FULL}" 2>&1 + nsdev=$(_find_nvme_passthru_loop_dev "${subsys_name}") + + # The following tests can race with the creation + # of the device so ensure the block device exists + # before continuing + while [ ! -b "${nsdev}" ]; do sleep 1; done + + echo "${nsdev}" +} + +_nvmet_passthru_target_disconnect() { + local subsys_name=$1 + + nvme disconnect -n "${subsys_name}" >>"${FULL}" 2>&1 +} + +_nvmet_passthru_target_cleanup() { + local port=$1 + local subsys_name=$2 + + _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" + _remove_nvmet_port "${port}" + _remove_nvmet_passhtru "${subsys_name}" +} + _filter_discovery() { sed -n -r -e "s/Generation counter [0-9]+/Generation counter X/" \ -e '/Discovery Log Number|Log Entry|trtype|subnqn/p' From patchwork Thu Aug 27 19:49:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 11741775 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C855F16B1 for ; Thu, 27 Aug 2020 19:50:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A4B392087E for ; Thu, 27 Aug 2020 19:50:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=deltatee.com header.i=@deltatee.com header.b="SZObRZlr" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728089AbgH0TuQ (ORCPT ); Thu, 27 Aug 2020 15:50:16 -0400 Received: from ale.deltatee.com ([204.191.154.188]:54882 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727986AbgH0TtW (ORCPT ); Thu, 27 Aug 2020 15:49:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=c143+GTEX7zyD/AulBS9Iu+zOY5FLCUer2NvCoDsSeI=; b=SZObRZlrY2eN4y+pUAiPO1SXTU Dx3AaFVhqM903maM+RjjDXpaIqCMPF3u5XQlnL/09MGb/3WX9T/+e1QSuCBrVPoqBs+fa/4XYuEyW XMYP9Fm+1qF0z/XghXrUWNBIgo7OoOMqMfqP5dl63s56/KolW/bpFAunH8z/kUpreKD4EHWe0RqLh YTyWPvT2decsz5mxb+OhypgpiLv3CSQ1aCf6IvndkisC5tykzNwwAkYxOmybsLseeXi6DsB4LYSig EQK4oPVWLztSi6JWwHXJVDUKge+ZcN6H4+WbdUxhECCME7mRmu8Ix/9ZeGxMtfq7R5J9ov9EdC8te ou0ktxeQ==; Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kBNtg-0000Cf-J2; Thu, 27 Aug 2020 13:49:21 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.92) (envelope-from ) id 1kBNta-0001c8-92; Thu, 27 Aug 2020 13:49:14 -0600 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, Omar Sandoval Cc: Sagi Grimberg , Chaitanya Kulkarni , Stephen Bates , Logan Gunthorpe Date: Thu, 27 Aug 2020 13:49:07 -0600 Message-Id: <20200827194912.6135-7-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200827194912.6135-1-logang@deltatee.com> References: <20200827194912.6135-1-logang@deltatee.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, osandov@osandov.com, sagi@grimberg.me, Chaitanya.Kulkarni@wdc.com, sbates@raithlin.com, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-6.7 required=5.0 tests=ALL_TRUSTED,BAYES_00, MYRULES_NO_TEXT,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Subject: [PATCH blktests 06/11] nvme/033: Simple test to create and connect to a passthru target X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org This tests creates and connects to a passthru controller backed by a test NVMe namespace. It then verifies that some common fields in id-ctrl and id-ns are the same in the target and the orginial device. Signed-off-by: Logan Gunthorpe --- tests/nvme/033 | 69 ++++++++++++++++++++++++++++++++++++++++++++++ tests/nvme/033.out | 6 ++++ 2 files changed, 75 insertions(+) create mode 100755 tests/nvme/033 create mode 100644 tests/nvme/033.out diff --git a/tests/nvme/033 b/tests/nvme/033 new file mode 100755 index 000000000000..e45c5e9758ba --- /dev/null +++ b/tests/nvme/033 @@ -0,0 +1,69 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2019 Logan Gunthorpe +# Copyright (C) 2019 Eideticom Communications Inc. + +. tests/nvme/rc + +DESCRIPTION="create and connect to an NVMeOF target with a passthru controller" +QUICK=1 + +requires() { + _have_program nvme && + _have_modules nvme-loop nvmet && + _have_configfs && + _have_kernel_option NVME_TARGET_PASSTHRU +} + +nvme_info() { + local ns=$1 + + nvme id-ctrl "$ns" | grep -E '^(vid|sn|mn|fr) ' + nvme id-ns "$ns" | grep -E '^(nsze|ncap) ' +} + +compare_dev_info() { + local passthru_dev=$1 + local testdev_info + local passthru_info + + testdev_info=$(nvme_info "$TEST_DEV") + passthru_info=$(nvme_info "$passthru_dev") + + cat >> "${FULL}" <<- EOF + + Test Device ${TEST_DEV} Info: + $testdev_info + + Passthru Device ${passthru_dev} Info: + $passthru_info + + EOF + + diff -u <(echo "$testdev_info") <(echo "$passthru_info") + if [[ "$testdev_info" != "$passthru_info" ]]; then + echo "ERROR: Device information does not match! (See ${FULL})" + fi +} + +test_device() { + local subsys="blktests-subsystem-1" + local nsdev + local port + + echo "Running ${TEST_NAME}" + + _setup_nvmet + port=$(_nvmet_passthru_target_setup "$subsys") + + nvme discover -t loop | _filter_discovery + + nsdev=$(_nvmet_passthru_target_connect "$subsys") + + compare_dev_info "${nsdev}" + + _nvmet_passthru_target_disconnect "$subsys" + _nvmet_passthru_target_cleanup "$port" "$subsys" + + echo "Test complete" +} diff --git a/tests/nvme/033.out b/tests/nvme/033.out new file mode 100644 index 000000000000..88787848654f --- /dev/null +++ b/tests/nvme/033.out @@ -0,0 +1,6 @@ +Running nvme/033 +Discovery Log Number of Records 1, Generation counter X +=====Discovery Log Entry 0====== +trtype: loop +subnqn: blktests-subsystem-1 +Test complete From patchwork Thu Aug 27 19:49:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 11741765 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C381F14E5 for ; Thu, 27 Aug 2020 19:50:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A5933207DF for ; Thu, 27 Aug 2020 19:50:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=deltatee.com header.i=@deltatee.com header.b="b1Tt20hr" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728130AbgH0TuQ (ORCPT ); Thu, 27 Aug 2020 15:50:16 -0400 Received: from ale.deltatee.com ([204.191.154.188]:54876 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727980AbgH0TtV (ORCPT ); Thu, 27 Aug 2020 15:49:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=eKZPvO1tKWLtBvuic8IXvf9/O03akYLNwwlOK0SGW5I=; b=b1Tt20hrJWzhLnvdH+/lzWKrLT Ycq5eHtejxhOMBEWa48hIi0YYVul3/02FjMcVJk4akVyqTAy/BtwrfM+vqYT6c7uheNiAjb1dJUbr nLxZ0oKb5NPfnpy2d3/TUD4JW6oVcHJxThtL6XWqpeBHGA3VTx9ha/5G6eqXuxxjztwwcymr6mr0h wc+phqREowva9NKwtzXZhWzdwjIEKyuP5wRwJb6e9e9Ipkpkcz8l0wADYa9/Q9aKfgoK+bx34oF3k Zl+icF/1m4HV1D9YpFWt5WHR6xU5OhMTGeEReAxP54rvfELiJQIAEGqmQ5XRzhMMD6uwjQlj3f3ar aPG5SRqQ==; Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kBNtg-0000Cc-IX; Thu, 27 Aug 2020 13:49:21 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.92) (envelope-from ) id 1kBNta-0001cB-Cw; Thu, 27 Aug 2020 13:49:14 -0600 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, Omar Sandoval Cc: Sagi Grimberg , Chaitanya Kulkarni , Stephen Bates , Logan Gunthorpe Date: Thu, 27 Aug 2020 13:49:08 -0600 Message-Id: <20200827194912.6135-8-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200827194912.6135-1-logang@deltatee.com> References: <20200827194912.6135-1-logang@deltatee.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, osandov@osandov.com, sagi@grimberg.me, Chaitanya.Kulkarni@wdc.com, sbates@raithlin.com, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-6.7 required=5.0 tests=ALL_TRUSTED,BAYES_00, MYRULES_NO_TEXT,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Subject: [PATCH blktests 07/11] nvme/034: Add test for passthru data verification X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Similar to test nvme/010 and nvme/011 but for a passthru controller Signed-off-by: Logan Gunthorpe --- tests/nvme/034 | 37 +++++++++++++++++++++++++++++++++++++ tests/nvme/034.out | 2 ++ 2 files changed, 39 insertions(+) create mode 100755 tests/nvme/034 create mode 100644 tests/nvme/034.out diff --git a/tests/nvme/034 b/tests/nvme/034 new file mode 100755 index 000000000000..18a539319c12 --- /dev/null +++ b/tests/nvme/034 @@ -0,0 +1,37 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2019 Logan Gunthorpe +# Copyright (C) 2019 Eideticom Communications Inc. + +. tests/nvme/rc + +DESCRIPTION="run data verification fio job on an NVMeOF passthru controller" +TIMED=1 + +requires() { + _have_program nvme && + _have_modules nvme-loop nvmet && + _have_configfs && + _have_kernel_option NVME_TARGET_PASSTHRU && + _have_fio +} + +test_device() { + local subsys="blktests-subsystem-1" + local ctrldev + local nsdev + local port + + echo "Running ${TEST_NAME}" + + _setup_nvmet + port=$(_nvmet_passthru_target_setup "$subsys") + nsdev=$(_nvmet_passthru_target_connect "$subsys") + + _run_fio_verify_io --size=950m --filename="${nsdev}" + + _nvmet_passthru_target_disconnect "$subsys" + _nvmet_passthru_target_cleanup "$port" "$subsys" + + echo "Test complete" +} diff --git a/tests/nvme/034.out b/tests/nvme/034.out new file mode 100644 index 000000000000..5c851b46779d --- /dev/null +++ b/tests/nvme/034.out @@ -0,0 +1,2 @@ +Running nvme/034 +Test complete From patchwork Thu Aug 27 19:49:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 11741755 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0688C14E5 for ; Thu, 27 Aug 2020 19:49:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E32D02087E for ; Thu, 27 Aug 2020 19:49:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=deltatee.com header.i=@deltatee.com header.b="YipRMnxn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727998AbgH0TtZ (ORCPT ); Thu, 27 Aug 2020 15:49:25 -0400 Received: from ale.deltatee.com ([204.191.154.188]:54846 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727959AbgH0TtU (ORCPT ); Thu, 27 Aug 2020 15:49:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=owdyuiWAgXc6gdvBmGEQOP1nWrWeXBypwNyTeAJ08TI=; b=YipRMnxnITFKCqPDBjApUgdO5+ yM3bLUvqNFat+qH3HqA+0vYgkf0N7WdBxM7n4ewVigc6haI5kQeb1dNam4LLzeBJDu4qHO9aauXMr na6EbGcNRCKZB/MgZ5C05y6oumVucvFGV0Q7c4JCDQJtsV9PPKso3pK0vAQaTbyuiwmTmBpUmmGLz r21ufakconhB1sC2ULVf5r25jCoIw7gQpTooKluTALjIUai0eb3axFwtPUg9cxiqZVwqNJz1CK4Mo Lmo6h2+HH0ZXof2dwX5cVILswiPiAG3cIR6XiABsLtJl8G/A/oyPlIsWSPB31QpuOj7dIGeFCmRNE e2OUXvXA==; Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kBNte-0000Cg-Os; Thu, 27 Aug 2020 13:49:19 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.92) (envelope-from ) id 1kBNta-0001cE-HP; Thu, 27 Aug 2020 13:49:14 -0600 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, Omar Sandoval Cc: Sagi Grimberg , Chaitanya Kulkarni , Stephen Bates , Logan Gunthorpe Date: Thu, 27 Aug 2020 13:49:09 -0600 Message-Id: <20200827194912.6135-9-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200827194912.6135-1-logang@deltatee.com> References: <20200827194912.6135-1-logang@deltatee.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, osandov@osandov.com, sagi@grimberg.me, Chaitanya.Kulkarni@wdc.com, sbates@raithlin.com, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-6.7 required=5.0 tests=ALL_TRUSTED,BAYES_00, MYRULES_NO_TEXT,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Subject: [PATCH blktests 08/11] nvme/035: Add test to verify passthru controller with a filesystem X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org This is a similar test as nvme/012 and nvme/013, except with a passthru controller. Signed-off-by: Logan Gunthorpe --- tests/nvme/035 | 39 +++++++++++++++++++++++++++++++++++++++ tests/nvme/035.out | 2 ++ 2 files changed, 41 insertions(+) create mode 100755 tests/nvme/035 create mode 100644 tests/nvme/035.out diff --git a/tests/nvme/035 b/tests/nvme/035 new file mode 100755 index 000000000000..de5f57c9b95f --- /dev/null +++ b/tests/nvme/035 @@ -0,0 +1,39 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2019 Logan Gunthorpe +# Copyright (C) 2019 Eideticom Communications Inc. + +. tests/nvme/rc +. common/xfs + +DESCRIPTION="run mkfs and data verification fio job on an NVMeOF passthru controller" +TIMED=1 + +requires() { + _have_program nvme && + _have_modules nvme-loop nvmet && + _have_configfs && + _have_kernel_option NVME_TARGET_PASSTHRU && + _have_xfs && + _have_fio +} + +test_device() { + local subsys="blktests-subsystem-1" + local ctrldev + local nsdev + local port + + echo "Running ${TEST_NAME}" + + _setup_nvmet + port=$(_nvmet_passthru_target_setup "$subsys") + nsdev=$(_nvmet_passthru_target_connect "$subsys") + + _xfs_run_fio_verify_io "${nsdev}" + + _nvmet_passthru_target_disconnect "$subsys" + _nvmet_passthru_target_cleanup "$port" "$subsys" + + echo "Test complete" +} diff --git a/tests/nvme/035.out b/tests/nvme/035.out new file mode 100644 index 000000000000..455110c046a5 --- /dev/null +++ b/tests/nvme/035.out @@ -0,0 +1,2 @@ +Running nvme/035 +Test complete From patchwork Thu Aug 27 19:49:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 11741753 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 715DB1575 for ; Thu, 27 Aug 2020 19:49:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 57411207F7 for ; Thu, 27 Aug 2020 19:49:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=deltatee.com header.i=@deltatee.com header.b="HvWWPkIs" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727997AbgH0TtX (ORCPT ); Thu, 27 Aug 2020 15:49:23 -0400 Received: from ale.deltatee.com ([204.191.154.188]:54848 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727963AbgH0TtU (ORCPT ); Thu, 27 Aug 2020 15:49:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=4YzG1tladZhrJ+ZejWw8s1C+BM1kGqknUOb0kMn5jOI=; b=HvWWPkIs7uoNZsJ34kILAgLHPy IkqsHWpRbb6KeUIEzxmHeItnxxDoF3EMBG+V755G1cIcE/zdh30xJFK7/qQcMOTlA2a7h3fpdwlbu WZP7e6avsKDOaW77eIXK1QVMjkqnn2b2DuyKCbwB2HIoHlLygIJAqXohvHPREbtSlxFagwi7i61sY uNFsuzFDojb6mS1r6/WtTsmEoguftnpP4EZyM+h9J6dgWv0xWs2JxdbJeiDLkqMwNbmm6Jry1kUvV g5l1mXDsIsN08mjhYR+dDrc2InlzwJflPAm7VpJc/6nZCkFDt1jhQRmP+bGNakYwh02Lq4FDGwQ5U bZJrJfHw==; Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kBNte-0000Cd-MR; Thu, 27 Aug 2020 13:49:19 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.92) (envelope-from ) id 1kBNta-0001cH-LU; Thu, 27 Aug 2020 13:49:14 -0600 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, Omar Sandoval Cc: Sagi Grimberg , Chaitanya Kulkarni , Stephen Bates , Logan Gunthorpe Date: Thu, 27 Aug 2020 13:49:10 -0600 Message-Id: <20200827194912.6135-10-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200827194912.6135-1-logang@deltatee.com> References: <20200827194912.6135-1-logang@deltatee.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, osandov@osandov.com, sagi@grimberg.me, Chaitanya.Kulkarni@wdc.com, sbates@raithlin.com, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-6.7 required=5.0 tests=ALL_TRUSTED,BAYES_00, MYRULES_NO_TEXT,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Subject: [PATCH blktests 09/11] nvme/036: Add test for testing reset command on nvme-passthru X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Similar to test 022 but for passthru controllers. Signed-off-by: Logan Gunthorpe --- tests/nvme/036 | 39 +++++++++++++++++++++++++++++++++++++++ tests/nvme/036.out | 2 ++ 2 files changed, 41 insertions(+) create mode 100755 tests/nvme/036 create mode 100644 tests/nvme/036.out diff --git a/tests/nvme/036 b/tests/nvme/036 new file mode 100755 index 000000000000..133aba6425a5 --- /dev/null +++ b/tests/nvme/036 @@ -0,0 +1,39 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2019 Logan Gunthorpe +# Copyright (C) 2019 Eideticom Communications Inc. + +. tests/nvme/rc + +DESCRIPTION="test NVMe reset command on an NVMeOF target with a passthru controller" +QUICK=1 + +requires() { + _have_program nvme && + _have_modules nvme-loop nvmet && + _have_configfs && + _have_kernel_option NVME_TARGET_PASSTHRU +} + +test_device() { + local subsys="blktests-subsystem-1" + local ctrldev + local port + + echo "Running ${TEST_NAME}" + + _setup_nvmet + port=$(_nvmet_passthru_target_setup "$subsys") + _nvmet_passthru_target_connect "$subsys" > /dev/null + + ctrldev=$(_find_nvme_loop_dev "$subsys") + + if ! nvme reset "/dev/${ctrldev}" >> "$FULL" 2>&1; then + echo "ERROR: reset failed" + fi + + _nvmet_passthru_target_disconnect "$subsys" + _nvmet_passthru_target_cleanup "$port" "$subsys" + + echo "Test complete" +} diff --git a/tests/nvme/036.out b/tests/nvme/036.out new file mode 100644 index 000000000000..58676b1c69f8 --- /dev/null +++ b/tests/nvme/036.out @@ -0,0 +1,2 @@ +Running nvme/036 +Test complete From patchwork Thu Aug 27 19:49:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 11741773 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9BA7A13B6 for ; Thu, 27 Aug 2020 19:50:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7C6BD2080C for ; Thu, 27 Aug 2020 19:50:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=deltatee.com header.i=@deltatee.com header.b="hSuGMfQ5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727979AbgH0TtU (ORCPT ); Thu, 27 Aug 2020 15:49:20 -0400 Received: from ale.deltatee.com ([204.191.154.188]:54830 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727949AbgH0TtT (ORCPT ); Thu, 27 Aug 2020 15:49:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=TkVopvHv5LAYAxNxYaHAAyEr54uZWHdpNC4+1QmgoMQ=; b=hSuGMfQ57klMFTRuxdvAeVDkuN eQDx0hMaKMjwQB+p6jJbfoGxDYRY1IIwifA0tx3dC2la+3BqfkYJVGkSvWcqwMLqOj8OvFwgac3M8 V3yMPLha4Hqc9TPZjF8XTOIf/hL+1dZRDwuOlZFvr5e8kUv3+0UvlMnSJm8RTw8G/i+9jShQa2++M utvDfxuNgP8MZ8yCEW8JRLwUnYiG5vt3x6frTZfrWA3BVKNsLW5BOlJ3wTPPU/I5/sUQZWZqi2ySx nMySv9Y6tykB9xEELh07Gt9qOBVIaZiTN7jS7yCui4ATOXWxdXsw6Nc5kLGYT68oL1idLe2vjdwG2 UasyRvOg==; Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kBNtd-0000Cf-OE; Thu, 27 Aug 2020 13:49:18 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.92) (envelope-from ) id 1kBNta-0001cK-Po; Thu, 27 Aug 2020 13:49:14 -0600 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, Omar Sandoval Cc: Sagi Grimberg , Chaitanya Kulkarni , Stephen Bates , Logan Gunthorpe Date: Thu, 27 Aug 2020 13:49:11 -0600 Message-Id: <20200827194912.6135-11-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200827194912.6135-1-logang@deltatee.com> References: <20200827194912.6135-1-logang@deltatee.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, osandov@osandov.com, sagi@grimberg.me, Chaitanya.Kulkarni@wdc.com, sbates@raithlin.com, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-6.7 required=5.0 tests=ALL_TRUSTED,BAYES_00, MYRULES_NO_TEXT,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Subject: [PATCH blktests 10/11] nvme/037: Add test which loops passthru connect and disconnect X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Similar to test nvme/031 except for passthru controllers. Note: it's normal to get I/O errors in this test as when the controller disconnects it races with the partition table read. Signed-off-by: Logan Gunthorpe --- tests/nvme/037 | 36 ++++++++++++++++++++++++++++++++++++ tests/nvme/037.out | 2 ++ 2 files changed, 38 insertions(+) create mode 100755 tests/nvme/037 create mode 100644 tests/nvme/037.out diff --git a/tests/nvme/037 b/tests/nvme/037 new file mode 100755 index 000000000000..dce25b9f63cf --- /dev/null +++ b/tests/nvme/037 @@ -0,0 +1,36 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2019 Logan Gunthorpe +# Copyright (C) 2019 Eideticom Communications Inc. + +. tests/nvme/rc + +DESCRIPTION="test deletion of NVMeOF passthru controllers immediately after setup" + +requires() { + _have_program nvme && + _have_modules nvme-loop nvmet && + _have_configfs && + _have_kernel_option NVME_TARGET_PASSTHRU +} + +test_device() { + local subsys="blktests-subsystem-" + local iterations=10 + local ctrldev + local port + + echo "Running ${TEST_NAME}" + + _setup_nvmet + + for ((i = 0; i < iterations; i++)); do + port=$(_nvmet_passthru_target_setup "${subsys}$i") + _nvmet_passthru_target_connect "${subsys}$i" > /dev/null + + _nvmet_passthru_target_disconnect "${subsys}$i" + _nvmet_passthru_target_cleanup "$port" "${subsys}$i" + done + + echo "Test complete" +} diff --git a/tests/nvme/037.out b/tests/nvme/037.out new file mode 100644 index 000000000000..eaf903d0520e --- /dev/null +++ b/tests/nvme/037.out @@ -0,0 +1,2 @@ +Running nvme/037 +Test complete From patchwork Thu Aug 27 19:49:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 11741751 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 44D421575 for ; Thu, 27 Aug 2020 19:49:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2DDC7207F7 for ; Thu, 27 Aug 2020 19:49:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=deltatee.com header.i=@deltatee.com header.b="GTatHXPt" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727993AbgH0TtV (ORCPT ); Thu, 27 Aug 2020 15:49:21 -0400 Received: from ale.deltatee.com ([204.191.154.188]:54828 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727945AbgH0TtT (ORCPT ); Thu, 27 Aug 2020 15:49:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=DAoZkGvyGri4FBXCJJ5289SPw0iwUdUnfJWjhiDDY2s=; b=GTatHXPthkBUKXWmo7elYdeWBJ 6WNOdAcf7gSxIpytWrdZxGKjd9PQwleelsvuI29S4rK/aR8xDJwPyE6SmkCnqyG3ZPG9P7ragNK6T eQ+vZcMhCcY6dUkGIdktqDm2tRV16HwyLQWyAzAi5sUsq8a7lcf2SfTxqU9VsVAlicuxXBX8vSlVp F+tAvQBPcYjSy3q+LtdQdKniZE8DlxPlVfgrxBVcgDYjd3n/FVOgniytxqPaMogzC3xMdk8+gUH6E SRdTX/DD//bFYM2X0aYxRsEqi//JVGCuYeiY52GPpZ+FBqjloZM4NJUDM2RUIRLUBKQwHcUnkqssW 9YScfu2A==; Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kBNtd-0000Ce-Nz; Thu, 27 Aug 2020 13:49:18 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.92) (envelope-from ) id 1kBNta-0001cN-U9; Thu, 27 Aug 2020 13:49:15 -0600 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, Omar Sandoval Cc: Sagi Grimberg , Chaitanya Kulkarni , Stephen Bates , Logan Gunthorpe Date: Thu, 27 Aug 2020 13:49:12 -0600 Message-Id: <20200827194912.6135-12-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200827194912.6135-1-logang@deltatee.com> References: <20200827194912.6135-1-logang@deltatee.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, osandov@osandov.com, sagi@grimberg.me, Chaitanya.Kulkarni@wdc.com, sbates@raithlin.com, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-6.7 required=5.0 tests=ALL_TRUSTED,BAYES_00, MYRULES_NO_TEXT,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Subject: [PATCH blktests 11/11] nvme/038: Test removal of un-enabled subsystem and ports X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Test that we can remove a subsystem that has not been enabled by passthru or any ns. Do the same for ports while we are at it. This was an issue in the original passthru patches and is not commonly tested. So this test will ensure we don't regress this. Signed-off-by: Logan Gunthorpe --- tests/nvme/038 | 38 ++++++++++++++++++++++++++++++++++++++ tests/nvme/038.out | 2 ++ 2 files changed, 40 insertions(+) create mode 100755 tests/nvme/038 create mode 100644 tests/nvme/038.out diff --git a/tests/nvme/038 b/tests/nvme/038 new file mode 100755 index 000000000000..29827f324155 --- /dev/null +++ b/tests/nvme/038 @@ -0,0 +1,38 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2019 Logan Gunthorpe +# Copyright (C) 2019 Eideticom Communications Inc. +# +# Test that we can remove a subsystem that has not been enabled by +# passthru or any ns. Do the same for ports while we are at it. +# +# This was an issue in the original passthru patches and is +# not commonly tested. So this test will ensure we don't regress this. +# +. tests/nvme/rc + +DESCRIPTION="test deletion of NVMeOF subsystem without enabling" +QUICK=1 + +requires() { + _have_program nvme && + _have_modules nvme-loop nvmet && + _have_configfs +} + +test() { + local subsys_path="${NVMET_CFS}/subsystems/blktests-subsystem-1" + local port + + echo "Running ${TEST_NAME}" + + _setup_nvmet + + mkdir -p "${subsys_path}" + rmdir "${subsys_path}" + + port=$(_create_nvmet_port loop) + _remove_nvmet_port "${port}" + + echo "Test complete" +} diff --git a/tests/nvme/038.out b/tests/nvme/038.out new file mode 100644 index 000000000000..06bc98022c33 --- /dev/null +++ b/tests/nvme/038.out @@ -0,0 +1,2 @@ +Running nvme/038 +Test complete