From patchwork Wed Jul 31 23:47:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 11069803 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 00430112C for ; Wed, 31 Jul 2019 23:47:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E5AA327F94 for ; Wed, 31 Jul 2019 23:47:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D7D7227F9F; Wed, 31 Jul 2019 23:47:26 +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 7708F27FAC for ; Wed, 31 Jul 2019 23:47:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727998AbfGaXrZ (ORCPT ); Wed, 31 Jul 2019 19:47:25 -0400 Received: from ale.deltatee.com ([207.54.116.67]:40120 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726175AbfGaXrZ (ORCPT ); Wed, 31 Jul 2019 19:47:25 -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 1hsyJX-0003gk-Lp; Wed, 31 Jul 2019 17:47:24 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1hsyJW-0001Qd-4d; Wed, 31 Jul 2019 17:47:22 -0600 From: Logan Gunthorpe To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, Omar Sandoval Cc: Logan Gunthorpe Date: Wed, 31 Jul 2019 17:47:08 -0600 Message-Id: <20190731234708.5450-1-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 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, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com Subject: [PATCH blktests] nvme/031: Add test to check controller deletion after setup 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 A number of bug fixes have been submitted to the kernel to fix bugs when a controller is removed immediately after it is set up. This new test ensures this doesn't regress. Signed-off-by: Logan Gunthorpe --- All of the fixes required for this test to pass have been on the list for a couple weeks, but not all of them have been merged. I'm not sure what the policy is for blktests for patches that aren't yet upstream but this patch is here for when it makes sense to pick it up. tests/nvme/031 | 55 ++++++++++++++++++++++++++++++++++++++++++++++ tests/nvme/031.out | 2 ++ 2 files changed, 57 insertions(+) create mode 100755 tests/nvme/031 create mode 100644 tests/nvme/031.out -- 2.20.1 diff --git a/tests/nvme/031 b/tests/nvme/031 new file mode 100755 index 000000000000..16390dcb380e --- /dev/null +++ b/tests/nvme/031 @@ -0,0 +1,55 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2019 Logan Gunthorpe +# +# Regression test for the following patches: +# nvme: fix controller removal race with scan work +# nvme: fix regression upon hot device removal and insertion +# nvme-core: Fix extra device_put() call on error path +# nvmet-loop: Flush nvme_delete_wq when removing the port +# nvmet: Fix use-after-free bug when a port is removed +# +# All these patches fix issues related to deleting a controller +# immediately after setting it up. + +. tests/nvme/rc + +DESCRIPTION="test deletion of NVMeOF controllers immediately after setup" +QUICK=1 + +requires() { + _have_program nvme && + _have_modules loop nvme-loop nvmet && + _have_configfs +} + +test() { + local subsys="blktests-subsystem-" + local iterations=10 + local loop_dev + local port + + echo "Running ${TEST_NAME}" + + _setup_nvmet + + truncate -s 1G "$TMPDIR/img" + + local loop_dev + loop_dev="$(losetup -f --show "$TMPDIR/img")" + + port="$(_create_nvmet_port "loop")" + + for ((i = 0; i < iterations; i++)); do + _create_nvmet_subsystem "${subsys}$i" "${loop_dev}" + _add_nvmet_subsys_to_port "${port}" "${subsys}$i" + nvme connect -t loop -n "${subsys}$i" + nvme disconnect -n "${subsys}$i" >> "${FULL}" 2>&1 + _remove_nvmet_subsystem_from_port "${port}" "${subsys}$i" + _remove_nvmet_subsystem "${subsys}$i" + done + + _remove_nvmet_port "${port}" + + echo "Test complete" +} diff --git a/tests/nvme/031.out b/tests/nvme/031.out new file mode 100644 index 000000000000..ae902bdd36d4 --- /dev/null +++ b/tests/nvme/031.out @@ -0,0 +1,2 @@ +Running nvme/031 +Test complete