From patchwork Thu Jan 17 12:59:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 10768031 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 6FE3C14E5 for ; Thu, 17 Jan 2019 12:59:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5DBF02EB8C for ; Thu, 17 Jan 2019 12:59:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 524D32EB91; Thu, 17 Jan 2019 12:59: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 035C1297A0 for ; Thu, 17 Jan 2019 12:59:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727584AbfAQM7S (ORCPT ); Thu, 17 Jan 2019 07:59:18 -0500 Received: from mx2.suse.de ([195.135.220.15]:40184 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725928AbfAQM7S (ORCPT ); Thu, 17 Jan 2019 07:59:18 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 14CE4AE47; Thu, 17 Jan 2019 12:59:17 +0000 (UTC) From: Johannes Thumshirn To: Omar Sandoval Cc: Linux Block Layer Mailinglist , Linux NVMe Mailinglist , Anthony Iliopoulos , Johannes Thumshirn Subject: [PATCH blktests 1/2] nvme: enable buffered_io for file-backed namespaces Date: Thu, 17 Jan 2019 13:59:05 +0100 Message-Id: <20190117125906.15479-1-jthumshirn@suse.de> X-Mailer: git-send-email 2.16.4 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 All file-based NVMe over Fabrics tests fail in my test environment as I'm running these tests form within an initramfs. It turns out the file backing store of the NVMe target defaults to using direct I/O which is not available on tmpfs for obvious reasons. If the backing store of an nvme target is file-based enable the use of buffered I/O. Signed-off-by: Johannes Thumshirn Signed-off-by: Johannes Thumshirn --- tests/nvme/rc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/nvme/rc b/tests/nvme/rc index eff1dd992460..ec92e41396be 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -48,7 +48,7 @@ _remove_nvmet_port() { _create_nvmet_ns() { local nvmet_subsystem="$1" local nsid="$2" - local blkdev="$3" + local backstore="$3" local uuid="00000000-0000-0000-0000-000000000000" local subsys_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}" local ns_path="${subsys_path}/namespaces/${nsid}" @@ -58,8 +58,11 @@ _create_nvmet_ns() { fi mkdir "${ns_path}" - printf "%s" "${blkdev}" > "${ns_path}/device_path" + printf "%s" "${backstore}" > "${ns_path}/device_path" printf "%s" "${uuid}" > "${ns_path}/device_uuid" + if [[ -f ${backstore} ]]; then + printf 1 > "${ns_path}/buffered_io" + fi printf 1 > "${ns_path}/enable" } From patchwork Thu Jan 17 12:59:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 10768033 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 5B70914E5 for ; Thu, 17 Jan 2019 12:59:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4CB262EB8E for ; Thu, 17 Jan 2019 12:59:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 414732F618; Thu, 17 Jan 2019 12:59:25 +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 D47FF2EB90 for ; Thu, 17 Jan 2019 12:59:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728068AbfAQM7Y (ORCPT ); Thu, 17 Jan 2019 07:59:24 -0500 Received: from mx2.suse.de ([195.135.220.15]:40224 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726832AbfAQM7X (ORCPT ); Thu, 17 Jan 2019 07:59:23 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 626BBAE47; Thu, 17 Jan 2019 12:59:22 +0000 (UTC) From: Johannes Thumshirn To: Omar Sandoval Cc: Linux Block Layer Mailinglist , Linux NVMe Mailinglist , Anthony Iliopoulos , Johannes Thumshirn Subject: [PATCH blktests 2/2] nvme: test resize of a namespace with file-backed ns Date: Thu, 17 Jan 2019 13:59:06 +0100 Message-Id: <20190117125906.15479-2-jthumshirn@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190117125906.15479-1-jthumshirn@suse.de> References: <20190117125906.15479-1-jthumshirn@suse.de> 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 Test resizing of a NVMe namespace by creating a file backed namespace over nvme-loop with 1G size, connecting to it and then resizing it to 2G. Check if /proc/partitions and blkdev --getsz $DEVICE see the updated size. Signed-off-by: Johannes Thumshirn Signed-off-by: Johannes Thumshirn --- tests/nvme/029 | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/nvme/029.out | 10 ++++++++ 2 files changed, 77 insertions(+) create mode 100755 tests/nvme/029 create mode 100644 tests/nvme/029.out diff --git a/tests/nvme/029 b/tests/nvme/029 new file mode 100755 index 000000000000..8c94af039d0f --- /dev/null +++ b/tests/nvme/029 @@ -0,0 +1,67 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0+ +# Copyright (c) 2019 Johannes Thumshirn +# +# Test resize of a namespace with file-backed ns + +. tests/nvme/rc + +DESCRIPTION="test resize of a namespace with file-backed ns" +QUICK=1 + +requires() { + _have_program nvme && _have_modules loop nvme-loop nvmet && \ + _have_configfs +} + +test() { + echo "Running ${TEST_NAME}" + + modprobe nvmet + modprobe nvme-loop + + local port + local nvmedev + local namespace + local file_path="$TMPDIR/img" + local subsys_name="blktests-subsystem-1" + + truncate -s 1G "${file_path}" + + _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + port="$(_create_nvmet_port "loop")" + _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + + nvme connect -t loop -n "${subsys_name}" + + nvmedev="$(_find_nvme_loop_dev)" + namespace="${nvmedev}n1" + cat "/sys/block/${namespace}/uuid" + cat "/sys/block/${namespace}/wwid" + + cat /proc/partitions | grep ${namespace} | awk '{ print $3 }' + blockdev --getsz /dev/${namespace} + + echo "Resizing" + truncate -s +1G "${file_path}" + printf 0 > ${NVMET_CFS}/subsystems/${subsys_name}/namespaces/1/enable + printf 1 > ${NVMET_CFS}/subsystems/${subsys_name}/namespaces/1/enable + sleep 1 + + cat /proc/partitions | grep ${namespace} | awk '{ print $3 }' + blockdev --getsz /dev/${namespace} + + nvme disconnect -n "${subsys_name}" + + _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" + _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_port "${port}" + + rm -f "${file_path}" + + modprobe -r nvme-loop + modprobe -r nvmet + + echo "Test complete" +} diff --git a/tests/nvme/029.out b/tests/nvme/029.out new file mode 100644 index 000000000000..e9571c7c9300 --- /dev/null +++ b/tests/nvme/029.out @@ -0,0 +1,10 @@ +Running nvme/029 +91fdba0d-f87b-4c25-b80f-db7be1418b9e +uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e +1048576 +2097152 +Resizing +2097152 +4194304 +NQN:blktests-subsystem-1 disconnected 1 controller(s) +Test complete