From patchwork Wed Jul 17 17:12:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 11048105 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 202CA1823 for ; Wed, 17 Jul 2019 17:13:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F01C28714 for ; Wed, 17 Jul 2019 17:13:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D4FA287C8; Wed, 17 Jul 2019 17:13:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 97F4E287E5 for ; Wed, 17 Jul 2019 17:13:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731144AbfGQRNO (ORCPT ); Wed, 17 Jul 2019 13:13:14 -0400 Received: from ale.deltatee.com ([207.54.116.67]:60192 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731085AbfGQRNO (ORCPT ); Wed, 17 Jul 2019 13:13:14 -0400 Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hnnUM-00012o-Uy; Wed, 17 Jul 2019 11:13:14 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1hnnUK-0000sL-42; Wed, 17 Jul 2019 11:13:08 -0600 From: Logan Gunthorpe To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, Omar Sandoval Cc: Chaitanya Kulkarni , Michael Moese , Theodore Ts'o , Johannes Thumshirn , Stephen Bates , Logan Gunthorpe Date: Wed, 17 Jul 2019 11:12:48 -0600 Message-Id: <20190717171259.3311-2-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190717171259.3311-1-logang@deltatee.com> References: <20190717171259.3311-1-logang@deltatee.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, osandov@fb.com, chaitanya.kulkarni@wdc.com, tytso@mit.edu, mmoese@suse.de, jthumshirn@suse.de, sbates@raithlin.com, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com Subject: [PATCH blktests v2 01/12] Add filter function for nvme discover X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +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 X-Virus-Scanned: ClamAV using ClamSMTP From: Michael Moese Several NVMe tests (002, 016, 017) used a pipe to a sed call filtering the output. This call is moved to a new filter function nvme/rc and the calls to sed are replaced by this function. Additionally, the test nvme/016 failed for me due to the Generation counter being greater than 1, so the new filter function was expanded to replace the Generation counter with 'X'. Signed-off-by: Michael Moese [logang@deltatee.com: added missing changes to 002.out and 017.out] Signed-off-by: Logan Gunthorpe Reviewed-by: Johannes Thumshirn --- tests/nvme/002 | 2 +- tests/nvme/002.out | 2 +- tests/nvme/016 | 2 +- tests/nvme/016.out | 2 +- tests/nvme/017 | 2 +- tests/nvme/017.out | 2 +- tests/nvme/rc | 5 +++++ 7 files changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/nvme/002 b/tests/nvme/002 index 106a5a8395f2..ceac1c677bd4 100755 --- a/tests/nvme/002 +++ b/tests/nvme/002 @@ -32,7 +32,7 @@ test() { _add_nvmet_subsys_to_port "${port}" "blktests-subsystem-$i" done - nvme discover -t loop | sed -r -e "s/portid: [0-9]+/portid: X/" + nvme discover -t loop | _filter_discovery for ((i = iterations - 1; i >= 0; i--)); do _remove_nvmet_subsystem_from_port "${port}" "blktests-subsystem-$i" diff --git a/tests/nvme/002.out b/tests/nvme/002.out index aa71d8f5f5f8..7437a21f60a9 100644 --- a/tests/nvme/002.out +++ b/tests/nvme/002.out @@ -1,6 +1,6 @@ Running nvme/002 -Discovery Log Number of Records 1000, Generation counter 1000 +Discovery Log Number of Records 1000, Generation counter X =====Discovery Log Entry 0====== trtype: loop adrfam: pci diff --git a/tests/nvme/016 b/tests/nvme/016 index 966d5dc0a4a2..dd1b84a16daa 100755 --- a/tests/nvme/016 +++ b/tests/nvme/016 @@ -34,7 +34,7 @@ test() { port="$(_create_nvmet_port "loop")" _add_nvmet_subsys_to_port "$port" "${subsys_nqn}" - nvme discover -t loop | sed -r -e "s/portid: [0-9]+/portid: X/" + nvme discover -t loop | _filter_discovery _remove_nvmet_subsystem_from_port "${port}" "${subsys_nqn}" _remove_nvmet_port "${port}" diff --git a/tests/nvme/016.out b/tests/nvme/016.out index 59bd2935346f..b70603144d5c 100644 --- a/tests/nvme/016.out +++ b/tests/nvme/016.out @@ -1,6 +1,6 @@ Running nvme/016 -Discovery Log Number of Records 1, Generation counter 1 +Discovery Log Number of Records 1, Generation counter X =====Discovery Log Entry 0====== trtype: loop adrfam: pci diff --git a/tests/nvme/017 b/tests/nvme/017 index 0b86bece9520..5f8d60907293 100755 --- a/tests/nvme/017 +++ b/tests/nvme/017 @@ -37,7 +37,7 @@ test() { port="$(_create_nvmet_port "loop")" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - nvme discover -t loop | sed -r -e "s/portid: [0-9]+/portid: X/" + nvme discover -t loop | _filter_discovery _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" _remove_nvmet_port "${port}" diff --git a/tests/nvme/017.out b/tests/nvme/017.out index 4b0877aaf3ca..cf212971d180 100644 --- a/tests/nvme/017.out +++ b/tests/nvme/017.out @@ -1,6 +1,6 @@ Running nvme/017 -Discovery Log Number of Records 1, Generation counter 1 +Discovery Log Number of Records 1, Generation counter X =====Discovery Log Entry 0====== trtype: loop adrfam: pci diff --git a/tests/nvme/rc b/tests/nvme/rc index eff1dd992460..22833d8ef9bb 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -118,3 +118,8 @@ _find_nvme_loop_dev() { fi done } + +_filter_discovery() { + sed -r -e "s/portid: [0-9]+/portid: X/" \ + -e "s/Generation counter [0-9]+/Generation counter X/" +} From patchwork Wed Jul 17 17:12:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 11048117 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 74CC9138B for ; Wed, 17 Jul 2019 17:13:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 63CC128821 for ; Wed, 17 Jul 2019 17:13:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 585CC287E9; Wed, 17 Jul 2019 17:13:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA22928761 for ; Wed, 17 Jul 2019 17:13:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731255AbfGQRNS (ORCPT ); Wed, 17 Jul 2019 13:13:18 -0400 Received: from ale.deltatee.com ([207.54.116.67]:60238 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731243AbfGQRNR (ORCPT ); Wed, 17 Jul 2019 13:13:17 -0400 Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hnnUM-00012q-Uz; Wed, 17 Jul 2019 11:13:17 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1hnnUK-0000sR-CH; Wed, 17 Jul 2019 11:13:08 -0600 From: Logan Gunthorpe To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, Omar Sandoval Cc: Chaitanya Kulkarni , Michael Moese , Theodore Ts'o , Johannes Thumshirn , Stephen Bates , Logan Gunthorpe Date: Wed, 17 Jul 2019 11:12:50 -0600 Message-Id: <20190717171259.3311-4-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190717171259.3311-1-logang@deltatee.com> References: <20190717171259.3311-1-logang@deltatee.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, osandov@fb.com, chaitanya.kulkarni@wdc.com, tytso@mit.edu, mmoese@suse.de, jthumshirn@suse.de, sbates@raithlin.com, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com Subject: [PATCH blktests v2 03/12] nvme: Add new test to verify the generation counter X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +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 X-Virus-Scanned: ClamAV using ClamSMTP Now that the other discovery tests ignore the generation counter value, create a new test to specifically check that it increments when subsystems are added or removed from ports and when allow_any_host is set/unset. Signed-off-by: Logan Gunthorpe --- tests/nvme/030 | 76 ++++++++++++++++++++++++++++++++++++++++++++++ tests/nvme/030.out | 2 ++ tests/nvme/rc | 5 +++ 3 files changed, 83 insertions(+) create mode 100755 tests/nvme/030 create mode 100644 tests/nvme/030.out diff --git a/tests/nvme/030 b/tests/nvme/030 new file mode 100755 index 000000000000..963e1ad7118c --- /dev/null +++ b/tests/nvme/030 @@ -0,0 +1,76 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2019 Logan Gunthorpe +# +# Test nvme discovery generation counter + +. tests/nvme/rc + +DESCRIPTION="ensure the discovery generation counter is updated appropriately" +QUICK=1 + +requires() { + _have_program nvme && + _have_modules loop nvme-loop nvmet && + _have_configfs +} + + +checkgenctr() { + local last=$1 + local msg=$2 + local genctr + + genctr=$(_discovery_genctr) + if (( "${genctr}" <= "${last}" )); then + echo "Generation counter not incremented when ${msg} (${genctr} <= ${last})" + fi + + echo "${genctr}" +} + +test() { + local port + local genctr + local subsys="blktests-subsystem-" + + echo "Running ${TEST_NAME}" + + modprobe nvmet + modprobe nvme-loop + + port="$(_create_nvmet_port "loop")" + + _create_nvmet_subsystem "${subsys}1" "$(losetup -f)" + _add_nvmet_subsys_to_port "${port}" "${subsys}1" + + genctr=$(_discovery_genctr) + + _create_nvmet_subsystem "${subsys}2" "$(losetup -f)" + _add_nvmet_subsys_to_port "${port}" "${subsys}2" + + genctr=$(checkgenctr "${genctr}" "adding a subsystem to a port") + + echo 0 > "${NVMET_CFS}/subsystems/${subsys}2/attr_allow_any_host" + + genctr=$(checkgenctr "${genctr}" "clearing attr_allow_any_host") + + echo 1 > "${NVMET_CFS}/subsystems/${subsys}2/attr_allow_any_host" + + genctr=$(checkgenctr "${genctr}" "setting attr_allow_any_host") + + _remove_nvmet_subsystem_from_port "${port}" "${subsys}2" + _remove_nvmet_subsystem "${subsys}2" + + genctr=$(checkgenctr "${genctr}" "removing a subsystem from a port") + + _remove_nvmet_subsystem_from_port "${port}" "${subsys}1" + _remove_nvmet_subsystem "${subsys}1" + + _remove_nvmet_port "${port}" + + modprobe -r nvme-loop + modprobe -r nvmet + + echo "Test complete" +} diff --git a/tests/nvme/030.out b/tests/nvme/030.out new file mode 100644 index 000000000000..93e51905b5d4 --- /dev/null +++ b/tests/nvme/030.out @@ -0,0 +1,2 @@ +Running nvme/030 +Test complete diff --git a/tests/nvme/rc b/tests/nvme/rc index 74e316248ef5..7be6c903611b 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -124,3 +124,8 @@ _filter_discovery() { -e '/Discovery Log Number|Log Entry|trtype|subnqn/p' } + +_discovery_genctr() { + nvme discover -t loop | + sed -n -e 's/^.*Generation counter \([0-9]\+\).*$/\1/p' +} From patchwork Wed Jul 17 17:12:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 11048097 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 29259138B for ; Wed, 17 Jul 2019 17:13:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 17287287CD for ; Wed, 17 Jul 2019 17:13:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B7C7287F3; Wed, 17 Jul 2019 17:13:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A571A287CD for ; Wed, 17 Jul 2019 17:13:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730912AbfGQRNO (ORCPT ); Wed, 17 Jul 2019 13:13:14 -0400 Received: from ale.deltatee.com ([207.54.116.67]:60174 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731076AbfGQRNN (ORCPT ); Wed, 17 Jul 2019 13:13:13 -0400 Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hnnUM-00012r-Uz; Wed, 17 Jul 2019 11:13:12 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1hnnUK-0000sU-F9; Wed, 17 Jul 2019 11:13:08 -0600 From: Logan Gunthorpe To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, Omar Sandoval Cc: Chaitanya Kulkarni , Michael Moese , Theodore Ts'o , Johannes Thumshirn , Stephen Bates , Logan Gunthorpe Date: Wed, 17 Jul 2019 11:12:51 -0600 Message-Id: <20190717171259.3311-5-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190717171259.3311-1-logang@deltatee.com> References: <20190717171259.3311-1-logang@deltatee.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, osandov@fb.com, chaitanya.kulkarni@wdc.com, tytso@mit.edu, mmoese@suse.de, jthumshirn@suse.de, sbates@raithlin.com, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com Subject: [PATCH blktests v2 04/12] nvme/003,004: Add missing calls to nvme disconnect X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +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 X-Virus-Scanned: ClamAV using ClamSMTP Tests 003 and 004 do not call nvme disconnect. In most cases it is cleaned up by removing the modules but it should be made explicit. Signed-off-by: Logan Gunthorpe Reviewed-by: Johannes Thumshirn --- tests/nvme/003 | 1 + tests/nvme/003.out | 1 + tests/nvme/004 | 1 + tests/nvme/004.out | 1 + 4 files changed, 4 insertions(+) diff --git a/tests/nvme/003 b/tests/nvme/003 index c6b3d4037aa6..374e6af0ca6f 100755 --- a/tests/nvme/003 +++ b/tests/nvme/003 @@ -42,6 +42,7 @@ test() { echo "Fail" fi + nvme disconnect -n nqn.2014-08.org.nvmexpress.discovery _remove_nvmet_subsystem_from_port "${port}" "blktests-subsystem-1" _remove_nvmet_subsystem "blktests-subsystem-1" _remove_nvmet_port "${port}" diff --git a/tests/nvme/003.out b/tests/nvme/003.out index 01b275612159..beb356128c9d 100644 --- a/tests/nvme/003.out +++ b/tests/nvme/003.out @@ -1,2 +1,3 @@ Running nvme/003 +NQN:nqn.2014-08.org.nvmexpress.discovery disconnected 1 controller(s) Test complete diff --git a/tests/nvme/004 b/tests/nvme/004 index 0506fa220de3..767aedaa0263 100755 --- a/tests/nvme/004 +++ b/tests/nvme/004 @@ -40,6 +40,7 @@ test() { cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" + nvme disconnect -n "blktests-subsystem-1" _remove_nvmet_subsystem_from_port "${port}" "blktests-subsystem-1" _remove_nvmet_subsystem "blktests-subsystem-1" _remove_nvmet_port "${port}" diff --git a/tests/nvme/004.out b/tests/nvme/004.out index 53f911ecf329..51f605227320 100644 --- a/tests/nvme/004.out +++ b/tests/nvme/004.out @@ -1,4 +1,5 @@ Running nvme/004 91fdba0d-f87b-4c25-b80f-db7be1418b9e uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e +NQN:blktests-subsystem-1 disconnected 1 controller(s) Test complete From patchwork Wed Jul 17 17:12:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 11048099 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 683081510 for ; Wed, 17 Jul 2019 17:13:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 55D6B287E5 for ; Wed, 17 Jul 2019 17:13:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 485B3287C9; Wed, 17 Jul 2019 17:13:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E8AB3287E5 for ; Wed, 17 Jul 2019 17:13:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731162AbfGQRNO (ORCPT ); Wed, 17 Jul 2019 13:13:14 -0400 Received: from ale.deltatee.com ([207.54.116.67]:60180 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731098AbfGQRNO (ORCPT ); Wed, 17 Jul 2019 13:13:14 -0400 Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hnnUM-00012s-Uz; Wed, 17 Jul 2019 11:13:13 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1hnnUK-0000sX-Hx; Wed, 17 Jul 2019 11:13:08 -0600 From: Logan Gunthorpe To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, Omar Sandoval Cc: Chaitanya Kulkarni , Michael Moese , Theodore Ts'o , Johannes Thumshirn , Stephen Bates , Logan Gunthorpe Date: Wed, 17 Jul 2019 11:12:52 -0600 Message-Id: <20190717171259.3311-6-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190717171259.3311-1-logang@deltatee.com> References: <20190717171259.3311-1-logang@deltatee.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, osandov@fb.com, chaitanya.kulkarni@wdc.com, tytso@mit.edu, mmoese@suse.de, jthumshirn@suse.de, sbates@raithlin.com, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com Subject: [PATCH blktests v2 05/12] nvme/005: Don't rely on modprobing to set the multipath paramater X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +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 X-Virus-Scanned: ClamAV using ClamSMTP On test systems with existing nvme drives or built-in modules it may not be possible to remove nvme-core in order to re-probe it with multipath=1. Instead, skip the test if the multipath parameter is not already set ahead of time. Note: the multipath parameter of nvme-core is set by default if CONFIG_NVME_MULTIPATH is set so this will only affect systems that explicitly disable it via the module parameter. Signed-off-by: Logan Gunthorpe --- common/rc | 18 ++++++++++++++++++ tests/nvme/005 | 10 ++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/common/rc b/common/rc index 5dd2c9512fd2..a487cc69026c 100644 --- a/common/rc +++ b/common/rc @@ -55,6 +55,24 @@ _have_module_param() { return 0 } +_have_module_param_value() { + local value + + modprobe "$1" + + if ! _have_module_param "$1" "$2"; then + return 1 + fi + + value=$(cat "/sys/module/$1/parameters/$2") + if [[ "${value}" != "$3" ]]; then + SKIP_REASON="$1 module parameter $2 must be set to $3" + return 1 + fi + + return 0 +} + _have_program() { if command -v "$1" >/dev/null 2>&1; then return 0 diff --git a/tests/nvme/005 b/tests/nvme/005 index e72fc809c936..91c164de73e6 100755 --- a/tests/nvme/005 +++ b/tests/nvme/005 @@ -12,18 +12,13 @@ QUICK=1 requires() { _have_modules loop nvme-core nvme-loop nvmet && \ - _have_module_param nvme-core multipath && _have_configfs + _have_module_param_value nvme_core multipath Y && \ + _have_configfs } test() { echo "Running ${TEST_NAME}" - # Clean up all stale modules - modprobe -r nvme-loop - modprobe -r nvme-core - modprobe -r nvmet - - modprobe nvme-core multipath=1 modprobe nvmet modprobe nvme-loop @@ -57,7 +52,6 @@ test() { rm "$TMPDIR/img" modprobe -r nvme-loop - modprobe -r nvme-core modprobe -r nvmet echo "Test complete" From patchwork Wed Jul 17 17:12:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 11048103 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EFBB91800 for ; Wed, 17 Jul 2019 17:13:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE448287C8 for ; Wed, 17 Jul 2019 17:13:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D2A7D287E9; Wed, 17 Jul 2019 17:13:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 556A0287C8 for ; Wed, 17 Jul 2019 17:13:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731175AbfGQRNO (ORCPT ); Wed, 17 Jul 2019 13:13:14 -0400 Received: from ale.deltatee.com ([207.54.116.67]:60188 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731144AbfGQRNO (ORCPT ); Wed, 17 Jul 2019 13:13:14 -0400 Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hnnUM-00012t-V2; Wed, 17 Jul 2019 11:13:13 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1hnnUK-0000sa-LB; Wed, 17 Jul 2019 11:13:08 -0600 From: Logan Gunthorpe To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, Omar Sandoval Cc: Chaitanya Kulkarni , Michael Moese , Theodore Ts'o , Johannes Thumshirn , Stephen Bates , Logan Gunthorpe Date: Wed, 17 Jul 2019 11:12:53 -0600 Message-Id: <20190717171259.3311-7-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190717171259.3311-1-logang@deltatee.com> References: <20190717171259.3311-1-logang@deltatee.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, osandov@fb.com, chaitanya.kulkarni@wdc.com, tytso@mit.edu, mmoese@suse.de, jthumshirn@suse.de, sbates@raithlin.com, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com Subject: [PATCH blktests v2 06/12] nvme/015: Ensure the namespace is flushed not the char device X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +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 X-Virus-Scanned: ClamAV using ClamSMTP Flushing the char device now results in the warning: nvme nvme1: using deprecated NVME_IOCTL_IO_CMD ioctl on the char device! Instead, call the flush on the namespace. Signed-off-by: Logan Gunthorpe Reviewed-by: Johannes Thumshirn --- tests/nvme/015 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/nvme/015 b/tests/nvme/015 index 47e1b048e16d..ca1216163e16 100755 --- a/tests/nvme/015 +++ b/tests/nvme/015 @@ -39,7 +39,7 @@ test() { dd if=/dev/urandom of="/dev/${nvmedev}n1" count=128000 bs=4k status=none - nvme flush "/dev/${nvmedev}" -n 1 + nvme flush "/dev/${nvmedev}n1" -n 1 nvme disconnect -n "${subsys_name}" From patchwork Wed Jul 17 17:12:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 11048115 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 54A67138B for ; Wed, 17 Jul 2019 17:13:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4321128820 for ; Wed, 17 Jul 2019 17:13:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3776128823; Wed, 17 Jul 2019 17:13:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 29A7D287ED for ; Wed, 17 Jul 2019 17:13:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731248AbfGQRNR (ORCPT ); Wed, 17 Jul 2019 13:13:17 -0400 Received: from ale.deltatee.com ([207.54.116.67]:60234 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731224AbfGQRNR (ORCPT ); Wed, 17 Jul 2019 13:13:17 -0400 Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hnnUM-00012u-V0; Wed, 17 Jul 2019 11:13:16 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1hnnUK-0000sd-ON; Wed, 17 Jul 2019 11:13:08 -0600 From: Logan Gunthorpe To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, Omar Sandoval Cc: Chaitanya Kulkarni , Michael Moese , Theodore Ts'o , Johannes Thumshirn , Stephen Bates , Logan Gunthorpe Date: Wed, 17 Jul 2019 11:12:54 -0600 Message-Id: <20190717171259.3311-8-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190717171259.3311-1-logang@deltatee.com> References: <20190717171259.3311-1-logang@deltatee.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, osandov@fb.com, chaitanya.kulkarni@wdc.com, tytso@mit.edu, mmoese@suse.de, jthumshirn@suse.de, sbates@raithlin.com, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com Subject: [PATCH blktests v2 07/12] nvme/018: Ignore error message generated by nvme read X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +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 X-Virus-Scanned: ClamAV using ClamSMTP nvme-cli at some point started printing the error message: NVMe status: CAP_EXCEEDED: The execution of the command has caused the capacity of the namespace to be exceeded(0x6081) This was not accounted for by test 018 and caused it to fail. This test does not need to test the error message content, it's only important that a read past the end of the file fails. Therefore, pipe stderr of nvme-cli to /dev/null. Signed-off-by: Logan Gunthorpe Reviewed-by: Johannes Thumshirn --- tests/nvme/018 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/nvme/018 b/tests/nvme/018 index e29fa92e8153..f5f5ecdb0989 100755 --- a/tests/nvme/018 +++ b/tests/nvme/018 @@ -44,9 +44,8 @@ test() { sectors="$(blockdev --getsz "/dev/${nvmedev}n1")" bs="$(blockdev --getbsz "/dev/${nvmedev}n1")" - if nvme read "/dev/${nvmedev}n1" -s "$sectors" -c 0 -z "$bs"; then - echo "ERROR: Successfully read out of device lba range" - fi + nvme read "/dev/${nvmedev}n1" -s "$sectors" -c 0 -z "$bs" 2>"$FULL" \ + && echo "ERROR: Successfully read out of device lba range" nvme disconnect -n "${subsys_name}" From patchwork Wed Jul 17 17:12:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 11048109 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5C5CB17E0 for ; Wed, 17 Jul 2019 17:13:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49665287CD for ; Wed, 17 Jul 2019 17:13:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 47A0C287E9; Wed, 17 Jul 2019 17:13:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F4099287E5 for ; Wed, 17 Jul 2019 17:13:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731208AbfGQRNQ (ORCPT ); Wed, 17 Jul 2019 13:13:16 -0400 Received: from ale.deltatee.com ([207.54.116.67]:60214 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731204AbfGQRNP (ORCPT ); Wed, 17 Jul 2019 13:13:15 -0400 Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hnnUM-00012v-Uz; Wed, 17 Jul 2019 11:13:14 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1hnnUK-0000sg-SK; Wed, 17 Jul 2019 11:13:08 -0600 From: Logan Gunthorpe To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, Omar Sandoval Cc: Chaitanya Kulkarni , Michael Moese , Theodore Ts'o , Johannes Thumshirn , Stephen Bates , Logan Gunthorpe Date: Wed, 17 Jul 2019 11:12:55 -0600 Message-Id: <20190717171259.3311-9-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190717171259.3311-1-logang@deltatee.com> References: <20190717171259.3311-1-logang@deltatee.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, osandov@fb.com, chaitanya.kulkarni@wdc.com, tytso@mit.edu, mmoese@suse.de, jthumshirn@suse.de, sbates@raithlin.com, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com Subject: [PATCH blktests v2 08/12] check: Add the ability to call a cleanup function after a test ends X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +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 X-Virus-Scanned: ClamAV using ClamSMTP In order to ensure tests properly clean themselves up, even if they are subject to interruption, add the ability to call a test specified function at cleanup time. Any test can call _register_test_cleanup with the first argument as a function to call after the test ends or is interrupted (similar to using 'trap EXIT'). Signed-off-by: Logan Gunthorpe Reviewed-by: Johannes Thumshirn --- check | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/check b/check index 029095e7cf38..981058c59c12 100755 --- a/check +++ b/check @@ -288,7 +288,15 @@ _output_test_run() { ) | column -t -s $'\t' } +_register_test_cleanup() { + TEST_CLEANUP=$1 +} + _cleanup() { + if [[ -v TEST_CLEANUP ]]; then + ${TEST_CLEANUP} + fi + if [[ "${TMPDIR:-}" ]]; then rm -rf "$TMPDIR" unset TMPDIR @@ -337,6 +345,7 @@ _call_test() { fi $LOGGER_PROG "run blktests $TEST_NAME" + unset TEST_CLEANUP trap _cleanup EXIT if ! TMPDIR="$(mktemp --tmpdir -p "$OUTPUT" -d "tmpdir.${TEST_NAME//\//.}.XXX")"; then return From patchwork Wed Jul 17 17:12:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 11048111 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 36F881510 for ; Wed, 17 Jul 2019 17:13:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 257BA287C9 for ; Wed, 17 Jul 2019 17:13:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 19B37287E9; Wed, 17 Jul 2019 17:13:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1FC24287C9 for ; Wed, 17 Jul 2019 17:13:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731204AbfGQRNQ (ORCPT ); Wed, 17 Jul 2019 13:13:16 -0400 Received: from ale.deltatee.com ([207.54.116.67]:60210 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731085AbfGQRNP (ORCPT ); Wed, 17 Jul 2019 13:13:15 -0400 Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hnnUM-00012w-Uz; Wed, 17 Jul 2019 11:13:14 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1hnnUK-0000sj-VD; Wed, 17 Jul 2019 11:13:08 -0600 From: Logan Gunthorpe To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, Omar Sandoval Cc: Chaitanya Kulkarni , Michael Moese , Theodore Ts'o , Johannes Thumshirn , Stephen Bates , Logan Gunthorpe Date: Wed, 17 Jul 2019 11:12:56 -0600 Message-Id: <20190717171259.3311-10-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190717171259.3311-1-logang@deltatee.com> References: <20190717171259.3311-1-logang@deltatee.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, osandov@fb.com, chaitanya.kulkarni@wdc.com, tytso@mit.edu, mmoese@suse.de, jthumshirn@suse.de, sbates@raithlin.com, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com Subject: [PATCH blktests v2 09/12] nvme: Cleanup modprobe lines into helper functions X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +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 X-Virus-Scanned: ClamAV using ClamSMTP Move all the lines to modprobe nvmet and nvme-loop into _setup_nvmet() and _cleanup_nvmet() helper functions and call _cleanup_nvmet() using _register_test_cleanup() to ensure it's always called after the test terminates. This will allow us to improve the cleanup of these tests and not leave the system in an inconsistent state when tests are aborted. Signed-off-by: Logan Gunthorpe Reviewed-by: Johannes Thumshirn --- tests/nvme/002 | 8 ++------ tests/nvme/003 | 5 +---- tests/nvme/004 | 5 +---- tests/nvme/005 | 6 +----- tests/nvme/006 | 6 +----- tests/nvme/007 | 6 +----- tests/nvme/008 | 6 +----- tests/nvme/009 | 5 +---- tests/nvme/010 | 6 +----- tests/nvme/011 | 6 +----- tests/nvme/012 | 6 +----- tests/nvme/013 | 6 +----- tests/nvme/014 | 6 +----- tests/nvme/015 | 3 +-- tests/nvme/016 | 4 +--- tests/nvme/017 | 6 +----- tests/nvme/018 | 3 +-- tests/nvme/019 | 6 +----- tests/nvme/020 | 5 +---- tests/nvme/021 | 6 +----- tests/nvme/022 | 6 +----- tests/nvme/023 | 6 +----- tests/nvme/024 | 6 +----- tests/nvme/025 | 6 +----- tests/nvme/026 | 6 +----- tests/nvme/027 | 6 +----- tests/nvme/028 | 6 +----- tests/nvme/029 | 6 +----- tests/nvme/030 | 6 +----- tests/nvme/rc | 11 +++++++++++ 30 files changed, 41 insertions(+), 134 deletions(-) diff --git a/tests/nvme/002 b/tests/nvme/002 index ceac1c677bd4..07b7fdae2d39 100755 --- a/tests/nvme/002 +++ b/tests/nvme/002 @@ -16,11 +16,9 @@ requires() { test() { echo "Running ${TEST_NAME}" - local iterations=1000 - - modprobe nvmet - modprobe nvme-loop + _setup_nvmet + local iterations=1000 local port port="$(_create_nvmet_port "loop")" @@ -41,7 +39,5 @@ test() { _remove_nvmet_port "${port}" - modprobe -r nvme-loop - modprobe -r nvmet echo "Test complete" } diff --git a/tests/nvme/003 b/tests/nvme/003 index 374e6af0ca6f..ed0feca3cac7 100755 --- a/tests/nvme/003 +++ b/tests/nvme/003 @@ -17,8 +17,7 @@ requires() { test() { echo "Running ${TEST_NAME}" - modprobe nvmet - modprobe nvme-loop + _setup_nvmet local port port="$(_create_nvmet_port "loop")" @@ -47,7 +46,5 @@ test() { _remove_nvmet_subsystem "blktests-subsystem-1" _remove_nvmet_port "${port}" - modprobe -r nvme-loop - modprobe -r nvmet echo "Test complete" } diff --git a/tests/nvme/004 b/tests/nvme/004 index 767aedaa0263..0debcd9c7049 100755 --- a/tests/nvme/004 +++ b/tests/nvme/004 @@ -18,8 +18,7 @@ requires() { test() { echo "Running ${TEST_NAME}" - modprobe nvmet - modprobe nvme-loop + _setup_nvmet local port port="$(_create_nvmet_port "loop")" @@ -47,7 +46,5 @@ test() { losetup -d "$loop_dev" rm "$TMPDIR/img" - modprobe -r nvme-loop - modprobe -r nvmet echo "Test complete" } diff --git a/tests/nvme/005 b/tests/nvme/005 index 91c164de73e6..8c79d234bb1d 100755 --- a/tests/nvme/005 +++ b/tests/nvme/005 @@ -19,8 +19,7 @@ requires() { test() { echo "Running ${TEST_NAME}" - modprobe nvmet - modprobe nvme-loop + _setup_nvmet local port port="$(_create_nvmet_port "loop")" @@ -51,8 +50,5 @@ test() { losetup -d "$loop_dev" rm "$TMPDIR/img" - modprobe -r nvme-loop - modprobe -r nvmet - echo "Test complete" } diff --git a/tests/nvme/006 b/tests/nvme/006 index d12d66bc5a8d..6c8e18560264 100755 --- a/tests/nvme/006 +++ b/tests/nvme/006 @@ -21,8 +21,7 @@ test() { local loop_dev local subsys_name="blktests-subsystem-1" - modprobe nvmet - modprobe nvme-loop + _setup_nvmet truncate -s 1G "$TMPDIR/img" @@ -41,8 +40,5 @@ test() { rm "$TMPDIR/img" - modprobe -r nvme-loop - modprobe -r nvmet - echo "Test complete" } diff --git a/tests/nvme/007 b/tests/nvme/007 index 6a57b7bf7e0d..58f4bf8808a1 100755 --- a/tests/nvme/007 +++ b/tests/nvme/007 @@ -20,8 +20,7 @@ test() { local file_path local subsys_name="blktests-subsystem-1" - modprobe nvmet - modprobe nvme-loop + _setup_nvmet file_path="${TMPDIR}/img" @@ -38,8 +37,5 @@ test() { rm "${file_path}" - modprobe -r nvme-loop - modprobe -r nvmet - echo "Test complete" } diff --git a/tests/nvme/008 b/tests/nvme/008 index 04ff0bda42e3..71ff4d962b00 100755 --- a/tests/nvme/008 +++ b/tests/nvme/008 @@ -17,8 +17,7 @@ requires() { test() { echo "Running ${TEST_NAME}" - modprobe nvmet - modprobe nvme-loop + _setup_nvmet local port local nvmedev @@ -53,8 +52,5 @@ test() { rm "${file_path}" - modprobe -r nvme-loop - modprobe -r nvmet - echo "Test complete" } diff --git a/tests/nvme/009 b/tests/nvme/009 index 81e61f99aba5..25c7da2ab854 100755 --- a/tests/nvme/009 +++ b/tests/nvme/009 @@ -16,8 +16,7 @@ requires() { test() { echo "Running ${TEST_NAME}" - modprobe nvmet - modprobe nvme-loop + _setup_nvmet local port local nvmedev @@ -47,7 +46,5 @@ test() { rm "${file_path}" - modprobe -r nvme-loop - modprobe -r nvmet echo "Test complete" } diff --git a/tests/nvme/010 b/tests/nvme/010 index ed7c95af2853..2ed0f4871a30 100755 --- a/tests/nvme/010 +++ b/tests/nvme/010 @@ -17,8 +17,7 @@ requires() { test() { echo "Running ${TEST_NAME}" - modprobe nvmet - modprobe nvme-loop + _setup_nvmet local port local nvmedev @@ -54,8 +53,5 @@ test() { rm "${file_path}" rm -f local*verify*state - modprobe -r nvme_loop - modprobe -r nvmet - echo "Test complete" } diff --git a/tests/nvme/011 b/tests/nvme/011 index fa638a193bad..974b33745b99 100755 --- a/tests/nvme/011 +++ b/tests/nvme/011 @@ -17,8 +17,7 @@ requires() { test() { echo "Running ${TEST_NAME}" - modprobe nvmet - modprobe nvme-loop + _setup_nvmet local port local nvmedev @@ -50,8 +49,5 @@ test() { rm "${file_path}" rm -f local-write-and-verify*state - modprobe -r nvme_loop - modprobe -r nvmet - echo "Test complete" } diff --git a/tests/nvme/012 b/tests/nvme/012 index d7a8751ec752..27981e903c58 100755 --- a/tests/nvme/012 +++ b/tests/nvme/012 @@ -17,8 +17,7 @@ requires() { test() { echo "Running ${TEST_NAME}" - modprobe nvmet - modprobe nvme-loop + _setup_nvmet local port local nvmedev @@ -66,8 +65,5 @@ test() { rm "${file_path}" rm -fr "${mount_dir}" - modprobe -r nvme_loop - modprobe -r nvmet - echo "Test complete" } diff --git a/tests/nvme/013 b/tests/nvme/013 index 131855298f0f..af5f3730a2fc 100755 --- a/tests/nvme/013 +++ b/tests/nvme/013 @@ -17,8 +17,7 @@ requires() { test() { echo "Running ${TEST_NAME}" - modprobe nvmet - modprobe nvme-loop + _setup_nvmet local port local nvmedev @@ -62,8 +61,5 @@ test() { rm "${file_path}" rm -fr "${mount_dir}" - modprobe -r nvme_loop - modprobe -r nvmet - echo "Test complete" } diff --git a/tests/nvme/014 b/tests/nvme/014 index 7de568faeff2..c255d5f12205 100755 --- a/tests/nvme/014 +++ b/tests/nvme/014 @@ -17,8 +17,7 @@ requires() { test() { echo "Running ${TEST_NAME}" - modprobe nvmet - modprobe nvme-loop + _setup_nvmet local port local nvmedev @@ -55,8 +54,5 @@ test() { rm "${file_path}" - modprobe -r nvme-loop - modprobe -r nvmet - echo "Test complete" } diff --git a/tests/nvme/015 b/tests/nvme/015 index ca1216163e16..a8497a2ba400 100755 --- a/tests/nvme/015 +++ b/tests/nvme/015 @@ -16,8 +16,7 @@ requires() { test() { echo "Running ${TEST_NAME}" - modprobe nvmet - modprobe nvme-loop + _setup_nvmet local port local nvmedev diff --git a/tests/nvme/016 b/tests/nvme/016 index dd1b84a16daa..9e670e7f6bcd 100755 --- a/tests/nvme/016 +++ b/tests/nvme/016 @@ -20,8 +20,7 @@ test() { local loop_dev local subsys_nqn="blktests-subsystem-1" - modprobe nvmet - modprobe nvme-loop + _setup_nvmet loop_dev="$(losetup -f)" @@ -44,6 +43,5 @@ test() { _remove_nvmet_subsystem "${subsys_nqn}" - modprobe -r nvme-loop nvmet echo "Test complete" } diff --git a/tests/nvme/017 b/tests/nvme/017 index 5f8d60907293..ef27de65cf2e 100755 --- a/tests/nvme/017 +++ b/tests/nvme/017 @@ -20,8 +20,7 @@ test() { local iterations=1000 local subsys_name="blktests-subsystem-1" - modprobe nvmet - modprobe nvme-loop + _setup_nvmet file_path="${TMPDIR}/img" @@ -49,8 +48,5 @@ test() { rm "${file_path}" - modprobe -r nvme-loop - modprobe -r nvmet - echo "Test complete" } diff --git a/tests/nvme/018 b/tests/nvme/018 index f5f5ecdb0989..0a5b4c2ab019 100755 --- a/tests/nvme/018 +++ b/tests/nvme/018 @@ -18,8 +18,7 @@ requires() { test() { echo "Running ${TEST_NAME}" - modprobe nvmet - modprobe nvme-loop + _setup_nvmet local port local nvmedev diff --git a/tests/nvme/019 b/tests/nvme/019 index 4a167361c42c..a8b0204ec0eb 100755 --- a/tests/nvme/019 +++ b/tests/nvme/019 @@ -17,8 +17,7 @@ requires() { test() { echo "Running ${TEST_NAME}" - modprobe nvmet - modprobe nvme-loop + _setup_nvmet local port local nvmedev @@ -55,8 +54,5 @@ test() { rm -f "${file_path}" - modprobe -r nvme-loop - modprobe -r nvmet - echo "Test complete" } diff --git a/tests/nvme/020 b/tests/nvme/020 index 6bd8075b1f4d..b480ee1b92d0 100755 --- a/tests/nvme/020 +++ b/tests/nvme/020 @@ -16,8 +16,7 @@ requires() { test() { echo "Running ${TEST_NAME}" - modprobe nvmet - modprobe nvme-loop + _setup_nvmet local port local nvmedev @@ -49,7 +48,5 @@ test() { rm -f "${file_path}" - modprobe -r nvme-loop - modprobe -r nvmet echo "Test complete" } diff --git a/tests/nvme/021 b/tests/nvme/021 index fef31b080c99..bbee54d16ff1 100755 --- a/tests/nvme/021 +++ b/tests/nvme/021 @@ -17,8 +17,7 @@ requires() { test() { echo "Running ${TEST_NAME}" - modprobe nvmet - modprobe nvme-loop + _setup_nvmet local port local nvmedev @@ -50,8 +49,5 @@ test() { rm -f "${file_path}" - modprobe -r nvme-loop - modprobe -r nvmet - echo "Test complete" } diff --git a/tests/nvme/022 b/tests/nvme/022 index 8f7492c0ff15..9ba07c1cc50f 100755 --- a/tests/nvme/022 +++ b/tests/nvme/022 @@ -17,8 +17,7 @@ requires() { test() { echo "Running ${TEST_NAME}" - modprobe nvmet - modprobe nvme-loop + _setup_nvmet local port local nvmedev @@ -50,8 +49,5 @@ test() { rm -f "${file_path}" - modprobe -r nvme-loop - modprobe -r nvmet - echo "Test complete" } diff --git a/tests/nvme/023 b/tests/nvme/023 index de1a6bc0f975..ed2a5ad7653f 100755 --- a/tests/nvme/023 +++ b/tests/nvme/023 @@ -17,8 +17,7 @@ requires() { test() { echo "Running ${TEST_NAME}" - modprobe nvmet - modprobe nvme-loop + _setup_nvmet local port local nvmedev @@ -55,8 +54,5 @@ test() { rm -f "${file_path}" - modprobe -r nvme-loop - modprobe -r nvmet - echo "Test complete" } diff --git a/tests/nvme/024 b/tests/nvme/024 index c88fbd8a3663..538580947c5c 100755 --- a/tests/nvme/024 +++ b/tests/nvme/024 @@ -17,8 +17,7 @@ requires() { test() { echo "Running ${TEST_NAME}" - modprobe nvmet - modprobe nvme-loop + _setup_nvmet local port local nvmedev @@ -49,8 +48,5 @@ test() { rm -f "${file_path}" - modprobe -r nvme-loop - modprobe -r nvmet - echo "Test complete" } diff --git a/tests/nvme/025 b/tests/nvme/025 index 6468f59d9dd9..0039fefa5007 100755 --- a/tests/nvme/025 +++ b/tests/nvme/025 @@ -17,8 +17,7 @@ requires() { test() { echo "Running ${TEST_NAME}" - modprobe nvmet - modprobe nvme-loop + _setup_nvmet local port local nvmedev @@ -50,8 +49,5 @@ test() { rm -f "${file_path}" - modprobe -r nvme-loop - modprobe -r nvmet - echo "Test complete" } diff --git a/tests/nvme/026 b/tests/nvme/026 index 2e9655bdd40f..7e89d840529c 100755 --- a/tests/nvme/026 +++ b/tests/nvme/026 @@ -17,8 +17,7 @@ requires() { test() { echo "Running ${TEST_NAME}" - modprobe nvmet - modprobe nvme-loop + _setup_nvmet local port local nvmedev @@ -50,8 +49,5 @@ test() { rm -f "${file_path}" - modprobe -r nvme-loop - modprobe -r nvmet - echo "Test complete" } diff --git a/tests/nvme/027 b/tests/nvme/027 index db732425db21..4d293beb8b47 100755 --- a/tests/nvme/027 +++ b/tests/nvme/027 @@ -17,8 +17,7 @@ requires() { test() { echo "Running ${TEST_NAME}" - modprobe nvmet - modprobe nvme-loop + _setup_nvmet local port local nvmedev @@ -49,8 +48,5 @@ test() { rm -f "${file_path}" - modprobe -r nvme-loop - modprobe -r nvmet - echo "Test complete" } diff --git a/tests/nvme/028 b/tests/nvme/028 index 10be8fb4ba9c..1280107ed5df 100755 --- a/tests/nvme/028 +++ b/tests/nvme/028 @@ -17,8 +17,7 @@ requires() { test() { echo "Running ${TEST_NAME}" - modprobe nvmet - modprobe nvme-loop + _setup_nvmet local port local nvmedev @@ -49,8 +48,5 @@ test() { rm -f "${file_path}" - modprobe -r nvme-loop - modprobe -r nvmet - echo "Test complete" } diff --git a/tests/nvme/029 b/tests/nvme/029 index e63dfc166f26..65eb40031888 100755 --- a/tests/nvme/029 +++ b/tests/nvme/029 @@ -50,8 +50,7 @@ test_user_io() test() { echo "Running ${TEST_NAME}" - modprobe nvmet - modprobe nvme-loop + _setup_nvmet local port local nvmedev @@ -92,8 +91,5 @@ test() { rm "${file_path}" - modprobe -r nvme-loop - modprobe -r nvmet - echo "Test complete" } diff --git a/tests/nvme/030 b/tests/nvme/030 index 963e1ad7118c..94020f47411e 100755 --- a/tests/nvme/030 +++ b/tests/nvme/030 @@ -36,8 +36,7 @@ test() { echo "Running ${TEST_NAME}" - modprobe nvmet - modprobe nvme-loop + _setup_nvmet port="$(_create_nvmet_port "loop")" @@ -69,8 +68,5 @@ test() { _remove_nvmet_port "${port}" - modprobe -r nvme-loop - modprobe -r nvmet - echo "Test complete" } diff --git a/tests/nvme/rc b/tests/nvme/rc index 7be6c903611b..16bdb7f0c083 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -24,6 +24,17 @@ _test_dev_is_nvme() { return 0 } +_cleanup_nvmet() { + modprobe -r nvme-loop + modprobe -r nvmet +} + +_setup_nvmet() { + _register_test_cleanup _cleanup_nvmet + modprobe nvmet + modprobe nvme-loop +} + _create_nvmet_port() { local trtype="$1" From patchwork Wed Jul 17 17:12:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 11048107 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1C1E9138B for ; Wed, 17 Jul 2019 17:13:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0BAEC287C9 for ; Wed, 17 Jul 2019 17:13:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 002EE287E9; Wed, 17 Jul 2019 17:13:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A0823287C9 for ; Wed, 17 Jul 2019 17:13:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731219AbfGQRNQ (ORCPT ); Wed, 17 Jul 2019 13:13:16 -0400 Received: from ale.deltatee.com ([207.54.116.67]:60218 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731208AbfGQRNP (ORCPT ); Wed, 17 Jul 2019 13:13:15 -0400 Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hnnUQ-00012x-8g; Wed, 17 Jul 2019 11:13:15 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1hnnUL-0000sm-2y; Wed, 17 Jul 2019 11:13:09 -0600 From: Logan Gunthorpe To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, Omar Sandoval Cc: Chaitanya Kulkarni , Michael Moese , Theodore Ts'o , Johannes Thumshirn , Stephen Bates , Logan Gunthorpe Date: Wed, 17 Jul 2019 11:12:57 -0600 Message-Id: <20190717171259.3311-11-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190717171259.3311-1-logang@deltatee.com> References: <20190717171259.3311-1-logang@deltatee.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, osandov@fb.com, chaitanya.kulkarni@wdc.com, tytso@mit.edu, mmoese@suse.de, jthumshirn@suse.de, sbates@raithlin.com, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com Subject: [PATCH blktests v2 10/12] nvme: Ensure all ports and subsystems are removed on cleanup X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +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 X-Virus-Scanned: ClamAV using ClamSMTP This ensures any test that fails or is interrupted will cleanup their subsystems. This will prevent the system from being left in an inconsistent state that will fail subsequent tests. Signed-off-by: Logan Gunthorpe Reviewed-by: Johannes Thumshirn --- tests/nvme/rc | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/tests/nvme/rc b/tests/nvme/rc index 16bdb7f0c083..a6b4d5938680 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -25,6 +25,49 @@ _test_dev_is_nvme() { } _cleanup_nvmet() { + local dev + local port + local subsys + local transport + local name + + if [[ ! -d "${NVMET_CFS}" ]]; then + return 0 + fi + + # Don't let successive Ctrl-Cs interrupt the cleanup processes + stty -isig + + shopt -s nullglob + + for dev in /sys/class/nvme/nvme*; do + dev="$(basename "$dev")" + transport="$(cat "/sys/class/nvme/${dev}/transport")" + if [[ "$transport" == "loop" ]]; then + echo "WARNING: Test did not clean up loop device: ${dev}" + nvme disconnect -d "${dev}" + fi + done + + for port in "${NVMET_CFS}"/ports/*; do + name=$(basename "${port}") + echo "WARNING: Test did not clean up port: ${name}" + rm -f "${port}"/subsystems/* + rmdir "${port}" + done + + for subsys in "${NVMET_CFS}"/subsystems/*; do + name=$(basename "${subsys}") + echo "WARNING: Test did not clean up subsystem: ${name}" + for ns in "${subsys}"/namespaces/*; do + rmdir "${ns}" + done + rmdir "${subsys}" + done + + shopt -u nullglob + stty isig + modprobe -r nvme-loop modprobe -r nvmet } From patchwork Wed Jul 17 17:12:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 11048119 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0513617E0 for ; Wed, 17 Jul 2019 17:13:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E73CE287C9 for ; Wed, 17 Jul 2019 17:13:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DBDD2287CD; Wed, 17 Jul 2019 17:13:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 01D86287CC for ; Wed, 17 Jul 2019 17:13:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731178AbfGQRNT (ORCPT ); Wed, 17 Jul 2019 13:13:19 -0400 Received: from ale.deltatee.com ([207.54.116.67]:60260 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731264AbfGQRNS (ORCPT ); Wed, 17 Jul 2019 13:13:18 -0400 Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hnnUQ-00012y-Ag; Wed, 17 Jul 2019 11:13:18 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1hnnUL-0000sp-5f; Wed, 17 Jul 2019 11:13:09 -0600 From: Logan Gunthorpe To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, Omar Sandoval Cc: Chaitanya Kulkarni , Michael Moese , Theodore Ts'o , Johannes Thumshirn , Stephen Bates , Logan Gunthorpe Date: Wed, 17 Jul 2019 11:12:58 -0600 Message-Id: <20190717171259.3311-12-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190717171259.3311-1-logang@deltatee.com> References: <20190717171259.3311-1-logang@deltatee.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, osandov@fb.com, chaitanya.kulkarni@wdc.com, tytso@mit.edu, mmoese@suse.de, jthumshirn@suse.de, sbates@raithlin.com, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com Subject: [PATCH blktests v2 11/12] common: Use sysfs instead of modinfo for _have_module_param() X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +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 X-Virus-Scanned: ClamAV using ClamSMTP Using modinfo fails if the given module is built-in. Instead, if the module is already in the kernel, check for the parameter in sysfs. Signed-off-by: Logan Gunthorpe Reviewed-by: Johannes Thumshirn --- common/rc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/rc b/common/rc index a487cc69026c..41aee3aaa735 100644 --- a/common/rc +++ b/common/rc @@ -48,6 +48,12 @@ _have_modules() { } _have_module_param() { + if [ -d "/sys/module/$1" ]; then + if [ -e "/sys/module/$1/parameters/$2" ]; then + return 0 + fi + fi + if ! modinfo -F parm -0 "$1" | grep -q -z "^$2:"; then SKIP_REASON="$1 module does not have parameter $2" return 1 From patchwork Wed Jul 17 17:12:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 11048113 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BB5C517E0 for ; Wed, 17 Jul 2019 17:13:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A660E28761 for ; Wed, 17 Jul 2019 17:13:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A443A287E9; Wed, 17 Jul 2019 17:13:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A440828761 for ; Wed, 17 Jul 2019 17:13:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731227AbfGQRNR (ORCPT ); Wed, 17 Jul 2019 13:13:17 -0400 Received: from ale.deltatee.com ([207.54.116.67]:60222 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731111AbfGQRNQ (ORCPT ); Wed, 17 Jul 2019 13:13:16 -0400 Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hnnUQ-00012z-DL; Wed, 17 Jul 2019 11:13:15 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1hnnUL-0000ss-8d; Wed, 17 Jul 2019 11:13:09 -0600 From: Logan Gunthorpe To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, Omar Sandoval Cc: Chaitanya Kulkarni , Michael Moese , Theodore Ts'o , Johannes Thumshirn , Stephen Bates , Logan Gunthorpe Date: Wed, 17 Jul 2019 11:12:59 -0600 Message-Id: <20190717171259.3311-13-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190717171259.3311-1-logang@deltatee.com> References: <20190717171259.3311-1-logang@deltatee.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, osandov@fb.com, chaitanya.kulkarni@wdc.com, tytso@mit.edu, mmoese@suse.de, jthumshirn@suse.de, sbates@raithlin.com, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com Subject: [PATCH blktests v2 12/12] nvme: Ignore errors when removing modules X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +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 X-Virus-Scanned: ClamAV using ClamSMTP It is no longer important for correct test functionality to remove the modules between tests. Therefore, we ignore errors if the modules are not removed (ie. if they are builtin). With this patch, it is now safe to run the tests with the nvmet modules built-in. This will be more convienent for developers that want to run the tests in a simple VM. Signed-off-by: Logan Gunthorpe Reviewed-by: Johannes Thumshirn --- tests/nvme/rc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/nvme/rc b/tests/nvme/rc index a6b4d5938680..348b4a3c2cbc 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -68,8 +68,8 @@ _cleanup_nvmet() { shopt -u nullglob stty isig - modprobe -r nvme-loop - modprobe -r nvmet + modprobe -r nvme-loop 2>/dev/null + modprobe -r nvmet 2>/dev/null } _setup_nvmet() {