From patchwork Wed Jan 29 23:29:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11357053 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 6324E924 for ; Wed, 29 Jan 2020 23:29:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 41237206D5 for ; Wed, 29 Jan 2020 23:29:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="Y6Fo5+jp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726617AbgA2X32 (ORCPT ); Wed, 29 Jan 2020 18:29:28 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:24315 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726401AbgA2X32 (ORCPT ); Wed, 29 Jan 2020 18:29:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1580340568; x=1611876568; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vsWnYxkL3guXdXYEXfUdlM4bUkHgg9d9fy/3CAVl06c=; b=Y6Fo5+jp1FF/6cXCmlp2Wu3fCLeUNIV6C+gXdfe5W2+FCmbCZpcGmJ8x eV2+kNnh9w0sPnP0fSv3+HaP5OWkoc5ubg0418dds1fyH2KpDvrLMqE7j 24Bs6dfuAEtdKCONnpm4fUn2jQNS9HJQiaBBShy9xuELpUqxTWpdUs5S6 eDASrn/6TVwXndr5pohTbeEBRt3LNNfs9VitvE+aeXcOfRIuwxr5Swy/0 RqxZuNolcDhbg3GpgatmGrNBzaifwVfI7UHdQ7XHfAlqGxvykSck+zKl9 OuuCExVHWMkZ6/4K5JBdSXmiw87sFA76qscVDoIZsphNz26/BYSc0hh63 w==; IronPort-SDR: zZvIixF9aH9MhYOHDgf1iYcyMoufXaZx6ip3+ot4Lfn/7AjiZW1lD5d/fgk9iWb/XmecPBPCkg osw4pNTuFy0z0Xs8fkU1opxfJ4N+PoTjg1tW88RH8PAxSG1N3rffBT6gcUtenjM/lsv39xuIlf nLcxiRhI3LipdWrSgT+fvEVkEm7oZ6NdgNm+6mh/FYwlLz7ybESD68XR5MlmmD/zQR0VkOE2W7 blslab6UJf2wsF7gWM0uQWQVW9ywyp2bxA2XNiA93Ax4Bj26sG0nveSNJYAlXlmdchc0icOS/2 sBo= X-IronPort-AV: E=Sophos;i="5.70,379,1574092800"; d="scan'208";a="128691692" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 30 Jan 2020 07:29:28 +0800 IronPort-SDR: fW9z84a4RYMxVXdDbfFdGou37Y9PMo/HmhRAORSTQq6aoVsL9BDylMIzvbSeJHKJ0WyAZkpq9M qiHJIpbl1r8ZfogUQxBQbJiXrb2epkgIxttkp3fgOQRYofAi7Uied8W9wmCd+crjYYwY9Jcpiv /weQSMBddOTlmRxFl8poI1fW5oPi3WSyFp9ropJYcmBk3qxFj0Ec0umDMrDgBcwisXfu54Z/qz yOinp17HApZks6mBixHudLf0lD24+XBU33R4oNgctLzF+SDbVKjVXeDodpW4SqtPPRqRne0B0x roS/+NUSp0/9bIdH8bMTWg0K Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jan 2020 15:22:40 -0800 IronPort-SDR: qiEFBqR7OxCyAa6e5I9ODkf3gO1TtAjCk3dZgU5zphyUrPJCAsydE1KW7ochUqJ36pDEo7dMug rZkX/g3bCMdzP2/m+6uT5GF44Nnh+06o4tR5ZuyBTyJeZKPxAzVEuQ9VZvksBiKLUxueXTJndO szdvZJ8JCiy/5NEXIsiWKcPzs4laWl2Q0sNkrRvsJtNNWozx5hKkqlCE3iXBNx0nZ03+jZRlvp KRTqTFP3JUnV3dpc8+R3IdTgjy75BaZrIE0HBs3vhvi7QANVPjUxymYSeS6sB44IUjxBHJJprY C5M= WDCIronportException: Internal Received: from iouring.labspan.wdc.com (HELO iouring.sc.wdc.com) ([10.6.138.107]) by uls-op-cesaip01.wdc.com with ESMTP; 29 Jan 2020 15:29:29 -0800 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org Cc: Chaitanya Kulkarni Subject: [PATCH 1/5 blktests] nvme: allow target subsys set cntlid min/max Date: Wed, 29 Jan 2020 15:29:17 -0800 Message-Id: <20200129232921.11771-2-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200129232921.11771-1-chaitanya.kulkarni@wdc.com> References: <20200129232921.11771-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org This patch updates helper function create_nvmet_subsystem() to handle newly introduced cntlid_min and cntlid_max attributes. Signed-off-by: Chaitanya Kulkarni --- tests/nvme/rc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/nvme/rc b/tests/nvme/rc index 40f0413..d1fa796 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -121,11 +121,18 @@ _create_nvmet_subsystem() { local nvmet_subsystem="$1" local blkdev="$2" local uuid=$3 + local cntlid_min=$4 + local cntlid_max=$5 local cfs_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}" mkdir -p "${cfs_path}" echo 1 > "${cfs_path}/attr_allow_any_host" _create_nvmet_ns "${nvmet_subsystem}" "1" "${blkdev}" "${uuid}" + + if [ $# -eq 5 ] && [ -f ${cfs_path}/attr_cntlid_min ]; then + echo ${cntlid_min} > ${cfs_path}/attr_cntlid_min + echo ${cntlid_max} > ${cfs_path}/attr_cntlid_max + fi } _remove_nvmet_ns() { From patchwork Wed Jan 29 23:29:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11357055 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 5D6AD1398 for ; Wed, 29 Jan 2020 23:29:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3C74320716 for ; Wed, 29 Jan 2020 23:29:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="MHsseLsw" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726648AbgA2X3b (ORCPT ); Wed, 29 Jan 2020 18:29:31 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:24315 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726401AbgA2X3b (ORCPT ); Wed, 29 Jan 2020 18:29:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1580340570; x=1611876570; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6LRKDrLJNKRzqs49kNk7BQqax8ZTUAptPqv9+XRu5GE=; b=MHsseLsw5+An9S8qK/yM/vwBlggPd+wjYls9/Yp9LE3HflWT7l6NES5G Ido40pjZlvqDqlV37NyjJbjqTtjNcHnKex8mGgMvMw8EGkz/VDT9bPqI3 Y5rV+lACo07N+O2YO4FhB36VOIbX3I5wVcIb+XA1XOpeO2kQGOX1W6JIX tAUyogaytuOVf6OpEYirkp8rBdOeEWa1pUDDJctI/9M6EMdaS9Zw2Eg0R B0m9sfczgHtzKxHM3etlqt0Ys0vqwTWMAbA80Kd38Xhx0C+7x22FDhZuK KEzWp9NuYFIjvsV3ufoLDEUbahVj9jZ7xYjvBcbouWzzVY6Fm/fObQmt0 g==; IronPort-SDR: 2tHyWaDHTymBqbaIuDQl3WsD4KfbJ13C4IQMBBlLYu/H/AtxhnPMRBMlmIHz/kx+dznrkfJqVl FzoxawJfIEJbGDi8F4jpfW+85ARaRvvs8EvJSIJjc6lkOJUMMRzdOm0qEa8U7phyN6f5Cg7puC IhNzkIhUNEJtYovpdo5TJDZr6dei82TrHH6+6Eobgib93kGFZWUu0tqWPdB39yJpKXP9fChuFt aM1I1IEsaqVSBsuJZj3kNpU9oEZ+jI4FnjeagE1P4+GfJQTiDttG63pTuRGx2dBGPRMiumgTOM YZE= X-IronPort-AV: E=Sophos;i="5.70,379,1574092800"; d="scan'208";a="128691695" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 30 Jan 2020 07:29:30 +0800 IronPort-SDR: +ZJSIYi+YhtKSgKhcYz9uxf7n3R2MbEYaZYrO/SoVGQZy/JzFB1l67dCQqvzV5xYA2/Xf1tl4U SXDwa+EFQ8u53rcD95H596YtaCzJ1UwApzPSUOfpu0KqmgUOX1VKwdtA9jFjus9vaaq/zRv7Co rOumY0zfvVhlQy9mC961pQ9JOo/nL4CvakmBWgZaNc4HZUTB3LJBzQtmehhl6uWaZqVwDPR13+ WD3RIV+g982iXpUMRarRPfF4kW/EtLkZSMaT+JeLVwZqiu7BVQ5cR3Z8UAUybBH2Lhb0XKudDR pOm8A3uwrt/BqtPm9No2ksoD Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jan 2020 15:22:42 -0800 IronPort-SDR: 7Z3ts7qElZgUF3XUm8Y4K1zcsg7VGjQAv3RDKP+yYNWNy1ls92mpDFadk5UBAQnqsp2I20viqf 8KFbd85lKDbLjXPZDPxdOEEq2G0wZ4jTyWG0obrDldOTd/1CNleP7P7XViPlFqWvU+OyjgmVrc 8RDYJY8Vrg8J0hR4gtxTtF+2zdE4gPVNRbrIkhi/VHgIMQJ/Vwgg/SN2mLNHZo7GR+KfMGYXsI OjeLHwIt7gRepdOjpeeDzCYPVjf3mjeVUIi61b/ILaWZzez9ECmVS17w/xZeOE4XMz4fNTdb9p MaI= WDCIronportException: Internal Received: from iouring.labspan.wdc.com (HELO iouring.sc.wdc.com) ([10.6.138.107]) by uls-op-cesaip01.wdc.com with ESMTP; 29 Jan 2020 15:29:31 -0800 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org Cc: Chaitanya Kulkarni Subject: [PATCH 2/5 blktests] nvme: test target cntlid min cntlid max Date: Wed, 29 Jan 2020 15:29:18 -0800 Message-Id: <20200129232921.11771-3-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200129232921.11771-1-chaitanya.kulkarni@wdc.com> References: <20200129232921.11771-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The new testcases exercises newly added cntlid [min|max] attributes for NVMeOF target. Signed-off-by: Chaitanya Kulkarni --- tests/nvme/033 | 57 ++++++++++++++++++++++++++++++++++++++++++++++ tests/nvme/033.out | 4 ++++ 2 files changed, 61 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 0000000..97eba7f --- /dev/null +++ b/tests/nvme/033 @@ -0,0 +1,57 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0+ +# Copyright (c) 2017-2018 Western Digital Corporation or its affiliates. +# +# Test NVMeOF target cntlid[min|max] attributes. + +. tests/nvme/rc + +DESCRIPTION="Test NVMeOF target cntlid[min|max] attributes" +QUICK=1 + +requires() { + _have_program nvme && _have_modules loop nvme-loop nvmet && \ + _have_configfs +} + +test() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + + local port + local nvmedev + local loop_dev + local cid_min=14 + local cid_max=15 + local file_path="$TMPDIR/img" + local subsys_name="blktests-subsystem-1" + + truncate -s 1G "${file_path}" + + loop_dev="$(losetup -f --show "${file_path}")" + + _create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \ + "91fdba0d-f87b-4c25-b80f-db7be1418b9e" ${cid_min} ${cid_max} + port="$(_create_nvmet_port "loop")" + _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + + nvme connect -t loop -n "${subsys_name}" + + udevadm settle + + nvmedev="$(_find_nvme_loop_dev)" + nvme id-ctrl /dev/${nvmedev}n1 | grep cntlid | tr -s ' ' ' ' + + nvme disconnect -n "${subsys_name}" + + _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" + _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_port "${port}" + + losetup -d "${loop_dev}" + + rm "${file_path}" + + echo "Test complete" +} diff --git a/tests/nvme/033.out b/tests/nvme/033.out new file mode 100644 index 0000000..b1b0d15 --- /dev/null +++ b/tests/nvme/033.out @@ -0,0 +1,4 @@ +Running nvme/033 +cntlid : e +NQN:blktests-subsystem-1 disconnected 1 controller(s) +Test complete From patchwork Wed Jan 29 23:29:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11357057 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 968451398 for ; Wed, 29 Jan 2020 23:29:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 751CC20716 for ; Wed, 29 Jan 2020 23:29:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="eR/icbVD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726663AbgA2X3d (ORCPT ); Wed, 29 Jan 2020 18:29:33 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:24315 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726401AbgA2X3c (ORCPT ); Wed, 29 Jan 2020 18:29:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1580340572; x=1611876572; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yhegzVwY8X2y0VM3m5FGUcNSnFAXWRc3w6Nd/G8krxw=; b=eR/icbVDb8CHETbOPOzfVf1uSWq8qf3+PHU1Vd22wgmMNAjSR4LrFyk5 cZqwij4fAhAYOqLvzvQrFyaQcrfRwDrxdbnnfz6ZQlCipKwyu1kp9jDW5 YNtmLuO5FSfhJ7AMXEcKhlJ3EsQ+76EF4fODisORUpwY4CJvYbVYpmVe7 l460bgBaXJZSg+XKo6I7zLj1t1xXL7OKDhzq9YtuemLt7WA81xVePnr8y tivq3muCX29927NaLVurUGVLTvWT6fVp/+adJN7/pvATsFdGRJgv/jjIl Bc5Bh7GLE6xF63eA8RALd4i0GkO0O3SBLuJpXjkPArTp9O1PgyFlK8EBM Q==; IronPort-SDR: BTrubU08Yrjcs6u0gpsuzdp7glXk3gU16Y237aQ9aD8pZ8RkcAMTxTbizukgTQJ/et88nlj3OP hPiMieARIwgvplFZEbPBsC+36mNkuYFM5QcvkVVlvdee4X76s91wnmqCrzg5lLjQdOH+h1ZQ3b aEUPzRbqSu++Q944f/FOu6NEQe75J9eO2k6QDvNXRsXXVuLIlOixUBxpM5w5p7GV96p/9oFgpT pRKDAhPTAR7peCMlfGu+Ui8PxypV4KaL+GxJMIeukCe/AbAg5OGP4oW+/SCuX523Sv3bIu3n3I UJM= X-IronPort-AV: E=Sophos;i="5.70,379,1574092800"; d="scan'208";a="128691696" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 30 Jan 2020 07:29:32 +0800 IronPort-SDR: QFRtojkkeFg9jmqfxsZALIX5QbNZJ3ALnwmjrjLVXkbMDsHfSiMxPY2fgN6n4kCVoY1asFS8yo V3JcP439V+PLLdP5opsgUChcEnN8VGb/9GCq67xvWKxUmuA6a/X9P7SXwaCN3krWPMm7iCpt6x H9k9eqRDJNBX1wlwb4c/FzyrH5Uw1foTLD764Iy2pQ9UYJIXpOCG+/Ju5EwFRdjcnL2ocxSJx5 wVMr5vtg9o+F9Q9Ft+Ms8W9nzaf+OPEFAIEtfAQOzeKvh89ElaONqPo8bHcmbwVM464nAuEPv4 rt8+EXSK5lmI06RgH6ux2fxa Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jan 2020 15:22:44 -0800 IronPort-SDR: QBrRE3i19TU7CMyH/+/ZQ2KESII2BUI7FX+WNJk99N93BFvc3LrphHytr8UhtizdCxCfLKaEwY 42sMvhuutrFd3wEjHJxETIHM5hwZzR8vPSQYW3pjgFlZ/XQlsOvp7A0u2OdXk2kbhqS0g0yB4e 96pu9II8ucDfpt1BChg/ipurvxToTDXvA25zfFk7vseIsTtWTbprnPGJ6e2vekP0bK97BMFcQ1 50cntKO00WRY/0VVGK11Guj4bRUxglOfk/muaIsGM2BK/sVPnvwtgjusEk09eh3E6e/n6KsbeM bUU= WDCIronportException: Internal Received: from iouring.labspan.wdc.com (HELO iouring.sc.wdc.com) ([10.6.138.107]) by uls-op-cesaip01.wdc.com with ESMTP; 29 Jan 2020 15:29:32 -0800 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org Cc: Chaitanya Kulkarni Subject: [PATCH 3/5 blktests] nvme: allow target subsys set model Date: Wed, 29 Jan 2020 15:29:19 -0800 Message-Id: <20200129232921.11771-4-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200129232921.11771-1-chaitanya.kulkarni@wdc.com> References: <20200129232921.11771-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org This patch updates helper function create_nvmet_subsystem() to handle newly introduced model attribute. Signed-off-by: Chaitanya Kulkarni --- tests/nvme/rc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/nvme/rc b/tests/nvme/rc index d1fa796..377c7f7 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -123,6 +123,7 @@ _create_nvmet_subsystem() { local uuid=$3 local cntlid_min=$4 local cntlid_max=$5 + local model=$6 local cfs_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}" mkdir -p "${cfs_path}" @@ -133,6 +134,9 @@ _create_nvmet_subsystem() { echo ${cntlid_min} > ${cfs_path}/attr_cntlid_min echo ${cntlid_max} > ${cfs_path}/attr_cntlid_max fi + if [ $# -eq 6 ] && [ -f ${cfs_path}/attr_model ]; then + echo ${model} > ${cfs_path}/attr_model + fi } _remove_nvmet_ns() { From patchwork Wed Jan 29 23:29:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11357059 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 465CA924 for ; Wed, 29 Jan 2020 23:29:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 260D3206F0 for ; Wed, 29 Jan 2020 23:29:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="Kh97kVwz" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726671AbgA2X3d (ORCPT ); Wed, 29 Jan 2020 18:29:33 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:24315 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726401AbgA2X3d (ORCPT ); Wed, 29 Jan 2020 18:29:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1580340573; x=1611876573; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KXZsNyr6H+GgS1XHW+oCnKz+5nhllTOXchAqtu9WpTE=; b=Kh97kVwzi1uYcTgpoKHnr7c0htZXkKIl9FPJy8FrFo+aagNY8Liq7Cpj pecq//5ZTmQEKBqZWC4P5OFzDJaArte/X9t47QyhBDY6FqMKfs8oaXTzA argcrk8/xPkGTf/fxHkNzQMUlEwsMVix4e9Fh9vhtbnGqydiYouqQ9Pe6 77fj7FJA4/mylQKaiUT2SvRR/iKjz+fBPJXxQX0aGg3mg+d/t7Vld9c7I zIyvmAfPgOCzsWdeuD3KhQG6aFPljBIpUIpQ9aCm97AmK9Z9JfbCMz+wl yoqPytaJPsUtP7lZaLBRU/sdqsxt4Md7mox1UYhecrwGJ+vRBrsfMTME3 A==; IronPort-SDR: 9edk02KLuF3RvpSiUt+XhdS/l5YS6K62oKEFOwd5dBm6CYkynnfkaVeqzOxD3HDo5vWOKT/8XK hR3h1OYVrAm5Zf34f3HHwMYfmDLM1mgK81gW3LrkVIwwIGemFLd+TZmBO/z5RJ5du3s3R2WS22 bvJYxC1bg5YKhuSti1R/H20PUAmYDjWO8l7IpGBfv4MpNaQpGHXfylIhGsCSX3o+RDQ5J/+/H/ XZxuTgeVJ0y8BBK3RgWmxfLw61XCBd6XBPwgVGDePbpaJb4huSAkVPQkEGhUKfJvLBwzrPyWsl 75c= X-IronPort-AV: E=Sophos;i="5.70,379,1574092800"; d="scan'208";a="128691698" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 30 Jan 2020 07:29:33 +0800 IronPort-SDR: PWP0xArGjb/+Z0g+3ZeYRtO/cujMsrU+iO7FZK7sMrHk2/glbi8Ad+FjOQmTwoRTLeoTpAuB5u Fd5JEfWOFSOOtoF29/4My62RWkA/aLO+nw9zp7qNKiL+LV19+LFLIT1kpuhQ7UHsisdfZVfgRI 34M/c7QspnD1JwyYrqI9bW+fIlKzayJZTWjTfOY7A2JfJn5zPTJt6fcbinW+pcrtf1ntfcY0nO R4od+Dyj0fYoY9sFbFJfYT+EXx9NNE7HapJbZkDp4u3pKwuZ+2+4JHk73d0Kmb4dUmO2xYVF8I wsnt8MqLDCzYPRNPndIH8aVw Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jan 2020 15:22:45 -0800 IronPort-SDR: +Fg+K68EUDIVpRmHuf0S6I/mwkBrljSa5T8RJpGzPLemxJPtQ/eeT8+hdmj4s+TO3xbMtWLijM 0ekH1rT2WIJVZIWUdEXtuyVBgX8kWvdTvYQfu6gfHd7NdUcfXFyhcRc/yBeThlvZZ6OWpEskP4 lLansx0+vPIlNRiZS4Ll8SVWnjK0oJHzeA00YLWiJobtD3ARFxI3ym+kve1ge4Lg9A4ZwhH2zb Kbqocnda3m/2FW2Dvn6tToxTDfrJmVgBji2cgsEilRzxn54CIUVm9mKvrsMkVYGuW0LGwmwaH1 EDI= WDCIronportException: Internal Received: from iouring.labspan.wdc.com (HELO iouring.sc.wdc.com) ([10.6.138.107]) by uls-op-cesaip01.wdc.com with ESMTP; 29 Jan 2020 15:29:33 -0800 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org Cc: Chaitanya Kulkarni Subject: [PATCH 4/5 blktests] nvme: test target model attribute Date: Wed, 29 Jan 2020 15:29:20 -0800 Message-Id: <20200129232921.11771-5-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200129232921.11771-1-chaitanya.kulkarni@wdc.com> References: <20200129232921.11771-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The new testcases exercises newly added cntlid [min|max] attribute for NVMeOF target. Signed-off-by: Chaitanya Kulkarni --- tests/nvme/034 | 60 ++++++++++++++++++++++++++++++++++++++++++++++ tests/nvme/034.out | 3 +++ 2 files changed, 63 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 0000000..1a55ff9 --- /dev/null +++ b/tests/nvme/034 @@ -0,0 +1,60 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0+ +# Copyright (c) 2017-2018 Western Digital Corporation or its affiliates. +# +# Test NVMeOF target cntlid[min|max] attributes. + +. tests/nvme/rc + +DESCRIPTION="Test NVMeOF target model attribute" +QUICK=1 + +requires() { + _have_program nvme && _have_modules loop nvme-loop nvmet && \ + _have_configfs +} + +test() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + + local port + local result + local nvmedev + local loop_dev + local model="test~model" + local file_path="$TMPDIR/img" + local subsys_name="blktests-subsystem-1" + + truncate -s 1G "${file_path}" + + loop_dev="$(losetup -f --show "${file_path}")" + + _create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \ + "91fdba0d-f87b-4c25-b80f-db7be1418b9e" 0 100 ${model} + port="$(_create_nvmet_port "loop")" + _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + + nvme connect -t loop -n "${subsys_name}" + + udevadm settle + + nvmedev="$(_find_nvme_loop_dev)" + nvme list | grep ${nvmedev}n1 | grep -q test~model + result=$? + + nvme disconnect -n "${subsys_name}" + + _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" + _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_port "${port}" + + losetup -d "${loop_dev}" + + rm "${file_path}" + + if [ ${result} -eq 0 ]; then + echo "Test complete" + fi +} diff --git a/tests/nvme/034.out b/tests/nvme/034.out new file mode 100644 index 0000000..0a7bd2f --- /dev/null +++ b/tests/nvme/034.out @@ -0,0 +1,3 @@ +Running nvme/034 +NQN:blktests-subsystem-1 disconnected 1 controller(s) +Test complete From patchwork Wed Jan 29 23:29:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11357061 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 27CED1398 for ; Wed, 29 Jan 2020 23:29:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F0F5320716 for ; Wed, 29 Jan 2020 23:29:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="ZZuihmTX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726677AbgA2X3f (ORCPT ); Wed, 29 Jan 2020 18:29:35 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:24315 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726401AbgA2X3f (ORCPT ); Wed, 29 Jan 2020 18:29:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1580340574; x=1611876574; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SVMZ6rDXDxbqh4kdUlp9IH8pJ8H96RNHWhe6WJPfMBM=; b=ZZuihmTXt6ycwJsLsTIZBCpFXuaDO5YzmNIvvhvZjrPZv5zjKz0sFYoM jvdXheYrJ5ayRSWTCWuhYEmhoA5lUX1bbWmhtOUNUlFkMZYKijdYOhuy0 SAhsnGD06hK77kVo6RZR/jOWbFyUg/RlCsmhrMy+QUdpVWn1CT/MyMsiH n3HPg3NmFVROL9cXp34004RbS98MI1FgPxFKtcq8iSAWDbo5mn1x3jdMc SPIaDACl1HqQ0q6wyEzFx2CDe6tymHov6klMf2Kq8EpIvFFf6nzy1d7Ya CGnBx+tnhO2VB/l3Code03lbq5jPgCufncSTtu1oSCc48jYJBdrXKPrCj A==; IronPort-SDR: Ukx9phanNdzU3aC0sy35tWcvpL2cMUncXaoRIdP0LHFOx4EJyNnWRPbfMHgB/B5XaXZX6os7L/ QxZOb7A7QtKqQE2hHTuyl9yhYPCw3VlmzlLShO/csorFBl9BOibU/OmWeE3NSs0Dsu/IG35Nbj 6tY8SzAaDaxiEBPCzMMYjyGMBYNfCtYKRHZBtfNuTGsQVsECHVx/nUk6zcaVlTP74gpD+uTZgW iRMY4lkgFlGL97ZZh50N/m9cpxtuCwQqvv+5UWna2Uc6vDb65XKv9Scj0aqPPd8XftNb6XUYC5 9rY= X-IronPort-AV: E=Sophos;i="5.70,379,1574092800"; d="scan'208";a="128691700" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 30 Jan 2020 07:29:34 +0800 IronPort-SDR: 3Tz0eLteqZnqWDDKWRhjO3GYjnsRplupH1VLxjLwFf/dERaKxysCHcFJXJ9yQuw70WyCIl/d9v wIEidHBZTIfYrGFDaBWQxtHMbQ5eOKi3qaj9A7SszkcxCOnNiyb4uekSYMOTzkDluK7V2bsXeW jQxsDouK02vi+bZPgoluHFjsSW/fKzVghtHBIg55uVo75fdGtSE4Cp4fU/oTdofwPVKrVMYUMs KEGcp2axedtqmr9HsJpbwEyuqs9GWIO7aCWOJKhNVlnbXG4OZZ34+r3nK5Z+G8zB4OfyurOq0n HUY0IfhcT1YM+L7iOL/VotLq Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jan 2020 15:22:46 -0800 IronPort-SDR: 0XlCdI7bSbpDT5MVYWh1/IJHF+0QNycY++B3dtpf3KPw0hkBZP8wtAa/c2Z0m5c0kNZWsMOTZx rLEOMnrTUvxgMLgyi+I1KFaAOa4ZtTqecRp/ruoJVJ5Vb5LSh6KeSx4cFuwW8EcIOgjmo8Qy48 W/YOP+GOn4O1d2L90C9/kJI5YLCNLGUIQ90SYS+iQOLj3mHtD9dnsbhV2EKBalhrxFlCt/YUdh 9PI+sN10C97nNTXRqVgHx9Al0HBYL9vQTxoOvj3GSgHMLrTfOlvAwAnAjnAu9ct5yqq2IlTnMs Kfk= WDCIronportException: Internal Received: from iouring.labspan.wdc.com (HELO iouring.sc.wdc.com) ([10.6.138.107]) by uls-op-cesaip01.wdc.com with ESMTP; 29 Jan 2020 15:29:35 -0800 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org Cc: Chaitanya Kulkarni Subject: [PATCH 5/5 blktests] nvme: make new testcases backward compatible Date: Wed, 29 Jan 2020 15:29:21 -0800 Message-Id: <20200129232921.11771-6-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200129232921.11771-1-chaitanya.kulkarni@wdc.com> References: <20200129232921.11771-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org This patch makes newly added testcases backward compatible with right value setting into the SKIP_REASON variable. Signed-off-by: Chaitanya Kulkarni --- tests/nvme/033 | 60 +++++++++++++++++++++++++++----------------------- tests/nvme/034 | 59 ++++++++++++++++++++++++++----------------------- tests/nvme/rc | 27 +++++++++++++++++------ 3 files changed, 83 insertions(+), 63 deletions(-) diff --git a/tests/nvme/033 b/tests/nvme/033 index 97eba7f..db5ded3 100755 --- a/tests/nvme/033 +++ b/tests/nvme/033 @@ -9,49 +9,53 @@ DESCRIPTION="Test NVMeOF target cntlid[min|max] attributes" QUICK=1 +PORT="" +NVMEDEV="" +LOOP_DEV="" +FILE_PATH="$TMPDIR/img" +SUBSYS_NAME="blktests-subsystem-1" + +_have_cid_min_max() +{ + local cid_min=14 + local cid_max=15 + + _setup_nvmet + truncate -s 1G "${FILE_PATH}" + LOOP_DEV="$(losetup -f --show "${FILE_PATH}")" + + # we can only know skip reason when we create a subsys + _create_nvmet_subsystem "${SUBSYS_NAME}" "${LOOP_DEV}" \ + "91fdba0d-f87b-4c25-b80f-db7be1418b9e" ${cid_min} ${cid_max} +} + requires() { _have_program nvme && _have_modules loop nvme-loop nvmet && \ - _have_configfs + _have_configfs && _have_cid_min_max } test() { echo "Running ${TEST_NAME}" - _setup_nvmet - - local port - local nvmedev - local loop_dev - local cid_min=14 - local cid_max=15 - local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" - - truncate -s 1G "${file_path}" - - loop_dev="$(losetup -f --show "${file_path}")" - - _create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" ${cid_min} ${cid_max} - port="$(_create_nvmet_port "loop")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + PORT="$(_create_nvmet_port "loop")" + _add_nvmet_subsys_to_port "${PORT}" "${SUBSYS_NAME}" - nvme connect -t loop -n "${subsys_name}" + nvme connect -t loop -n "${SUBSYS_NAME}" udevadm settle - nvmedev="$(_find_nvme_loop_dev)" - nvme id-ctrl /dev/${nvmedev}n1 | grep cntlid | tr -s ' ' ' ' + NVMEDEV="$(_find_nvme_loop_dev)" + nvme id-ctrl /dev/${NVMEDEV}n1 | grep cntlid | tr -s ' ' ' ' - nvme disconnect -n "${subsys_name}" + nvme disconnect -n "${SUBSYS_NAME}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" - _remove_nvmet_port "${port}" + _remove_nvmet_subsystem_from_port "${PORT}" "${SUBSYS_NAME}" + _remove_nvmet_subsystem "${SUBSYS_NAME}" + _remove_nvmet_port "${PORT}" - losetup -d "${loop_dev}" + losetup -d "${LOOP_DEV}" - rm "${file_path}" + rm "${FILE_PATH}" echo "Test complete" } diff --git a/tests/nvme/034 b/tests/nvme/034 index 1a55ff9..39d833f 100755 --- a/tests/nvme/034 +++ b/tests/nvme/034 @@ -9,50 +9,53 @@ DESCRIPTION="Test NVMeOF target model attribute" QUICK=1 +PORT="" +NVMEDEV="" +LOOP_DEV="" +FILE_PATH="$TMPDIR/img" +SUBSYS_NAME="blktests-subsystem-1" + +_have_model() +{ + local model="test~model" + + _setup_nvmet + truncate -s 1G "${FILE_PATH}" + LOOP_DEV="$(losetup -f --show "${FILE_PATH}")" + + # we can only know skip reason when we create a subsys + _create_nvmet_subsystem "${SUBSYS_NAME}" "${LOOP_DEV}" \ + "91fdba0d-f87b-4c25-b80f-db7be1418b9e" 14 15 \ + ${model} +} requires() { _have_program nvme && _have_modules loop nvme-loop nvmet && \ - _have_configfs + _have_configfs && _have_model } test() { echo "Running ${TEST_NAME}" - _setup_nvmet - - local port - local result - local nvmedev - local loop_dev - local model="test~model" - local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" - - truncate -s 1G "${file_path}" - - loop_dev="$(losetup -f --show "${file_path}")" - - _create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" 0 100 ${model} - port="$(_create_nvmet_port "loop")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + PORT="$(_create_nvmet_port "loop")" + _add_nvmet_subsys_to_port "${PORT}" "${SUBSYS_NAME}" - nvme connect -t loop -n "${subsys_name}" + nvme connect -t loop -n "${SUBSYS_NAME}" udevadm settle - nvmedev="$(_find_nvme_loop_dev)" - nvme list | grep ${nvmedev}n1 | grep -q test~model + NVMEDEV="$(_find_nvme_loop_dev)" + nvme list | grep ${NVMEDEV}n1 | grep -q test~model result=$? - nvme disconnect -n "${subsys_name}" + nvme disconnect -n "${SUBSYS_NAME}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" - _remove_nvmet_port "${port}" + _remove_nvmet_subsystem_from_port "${PORT}" "${SUBSYS_NAME}" + _remove_nvmet_subsystem "${SUBSYS_NAME}" + _remove_nvmet_port "${PORT}" - losetup -d "${loop_dev}" + losetup -d "${LOOP_DEV}" - rm "${file_path}" + rm "${FILE_PATH}" if [ ${result} -eq 0 ]; then echo "Test complete" diff --git a/tests/nvme/rc b/tests/nvme/rc index 377c7f7..77bafd8 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -128,15 +128,28 @@ _create_nvmet_subsystem() { mkdir -p "${cfs_path}" echo 1 > "${cfs_path}/attr_allow_any_host" - _create_nvmet_ns "${nvmet_subsystem}" "1" "${blkdev}" "${uuid}" - - if [ $# -eq 5 ] && [ -f ${cfs_path}/attr_cntlid_min ]; then - echo ${cntlid_min} > ${cfs_path}/attr_cntlid_min - echo ${cntlid_max} > ${cfs_path}/attr_cntlid_max + if [ $# -eq 5 ]; then + if [ -f ${cfs_path}/attr_cntlid_min ]; then + echo ${cntlid_min} > ${cfs_path}/attr_cntlid_min + echo ${cntlid_max} > ${cfs_path}/attr_cntlid_max + else + SKIP_REASON="attr_cntlid_[min|max] not found" + rmdir "${cfs_path}" + return 1 + fi fi - if [ $# -eq 6 ] && [ -f ${cfs_path}/attr_model ]; then - echo ${model} > ${cfs_path}/attr_model + if [ $# -eq 6 ]; then + if [ -f ${cfs_path}/attr_model ]; then + echo ${model} > ${cfs_path}/attr_model + else + SKIP_REASON="attr_cntlid_model not found" + rmdir "${cfs_path}" + return 1 + fi fi + _create_nvmet_ns "${nvmet_subsystem}" "1" "${blkdev}" "${uuid}" + + return 0 } _remove_nvmet_ns() {