From patchwork Fri Aug 19 09:39:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinichiro Kawasaki X-Patchwork-Id: 12948616 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F10D5C32773 for ; Fri, 19 Aug 2022 09:39:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348141AbiHSJj3 (ORCPT ); Fri, 19 Aug 2022 05:39:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348169AbiHSJjZ (ORCPT ); Fri, 19 Aug 2022 05:39:25 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8A0779EC6 for ; Fri, 19 Aug 2022 02:39:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1660901963; x=1692437963; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rpz/zcomyJM90Cd8YUsVLDGWob4pxyNxaHt5xngOfi8=; b=bbK8wLM/a3vnPEnI0ulhrlltaBshNmxz/IG0mpyTchrN07YceuiryZcb TDQGywwpEReeI5sbljJNbSTNVnBduH12kj+Cw0wyl/s9Pip1n3DnCf0J7 R1HiCuBGVDaddAcIvobNwL0M/RNG083vINFxQAI62sHGCKZOWXZ21+HLy Pdyp5Ti/712+h9SwG4e+hGJam+kUTs65oYZ1ofCM1fVr+auRDtd2ex7JO ZQMD6tJzhv0QR3kOJNOKqvtYPAteeclV+15cSyL3eZvSrZ86veCMA8cxX EaR7//kRGJvEhgjuhhG/e/TLEGrFtQ1eDngoQgzu5Iz9PSx9WJyZ9EAEM A==; X-IronPort-AV: E=Sophos;i="5.93,247,1654531200"; d="scan'208";a="313411534" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 19 Aug 2022 17:39:23 +0800 IronPort-SDR: n4K0J2PVT9j+g2R83peiTyvW4eOh1NxXsx2yEJW1NnjaxuRKECExjPU7Bs1MRf3hsl1silaRhb B1u1H6zF6f77bEb0vV7S3odT4sRtZ/ydI6CXKwJL1QFnHKOezP3mRpo54i/83IVAtzQmkEEkun AtNwIb+RrvFU7ssOwrEM1yW7t9V7Cdqo9oPMWE4ta75uB2IzyKKV5waUh7nvJCVJsIOvNfYl0F WvYuIdf5dn5VzU+AilLGQavW1yXD4LKJP05jKFJImKcSZD3cX79wY+XNAqVep36sWqXc3+hwlG A1lzo2JuUugtbiZxDcewWlTp Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 19 Aug 2022 01:54:47 -0700 IronPort-SDR: pQvy5ARyUbUuijPzX7xIIT05nSnutOlSfhkL/YlvbbUadacogUD5l8LMwXQMow5CKwT3k5wYy3 s+ir2LuN9ZGRqeBhtiwLSlgIbj04Irnbx0NVurCvh0MxcsAmgA42tO84Lo5rSSVFpvkepzT1gE LGkQQ7GE12rOTqxftNMnWRED+IW4BqkhK9caiWrleU2q4qWSy0wHpDDTax1mJdf92b6eJ8cvPs GChKBU7Vw0NWDFEfMY/b+9VvCpMjmmmOQ2gT1tJQGJNitqMtMi26Z8svY1DOYMzAY1UUOOvqXk 5zg= WDCIronportException: Internal Received: from shindev.dhcp.fujisawa.hgst.com (HELO shindev.fujisawa.hgst.com) ([10.149.52.207]) by uls-op-cesaip01.wdc.com with ESMTP; 19 Aug 2022 02:39:22 -0700 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org Cc: Bart Van Assche , Christoph Hellwig , Johannes Thumshirn , Shin'ichiro Kawasaki Subject: [PATCH blktests v3 1/6] common/rc: avoid module load in _have_driver() Date: Fri, 19 Aug 2022 18:39:15 +0900 Message-Id: <20220819093920.84992-2-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220819093920.84992-1-shinichiro.kawasaki@wdc.com> References: <20220819093920.84992-1-shinichiro.kawasaki@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The helper function _have_driver() checks availability of the specified driver, or module, regardless whether it is loadable or not. When the driver is loadable, it loads the module for checking, but does not unload it. This makes following test cases fail. Such failure happens when nvmeof-mp test group is executed after nvme test group with tcp transport. _have_driver() for tcp transport loads nvmet and nvmet-tcp modules. nvmeof-mp test group tries to unload the nvmet module but it fails because of dependency to the nvmet-tcp module. To avoid the failure, do not load module in _have_driver() using -n dry run option of the modprobe command. While at it, fix a minor problem of modname '-' replacement. Currently, only the first '-' in modname is replaced with '_'. Replace all '-'s. Fixes: e9645877fbf0 ("common: add a helper if a driver is available") Signed-off-by: Shin'ichiro Kawasaki Reviewed-by: Christoph Hellwig Reviewed-by: Bart Van Assche --- common/rc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common/rc b/common/rc index 01df6fa..5b34c60 100644 --- a/common/rc +++ b/common/rc @@ -30,9 +30,10 @@ _have_root() { _have_driver() { - local modname="${1/-/_}" + local modname="${1//-/_}" - if [ ! -d "/sys/module/${modname}" ] && ! modprobe -q "${modname}"; then + if [ ! -d "/sys/module/${modname}" ] && + ! modprobe -qn "${modname}"; then SKIP_REASONS+=("driver ${modname} is not available") return 1 fi From patchwork Fri Aug 19 09:39:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinichiro Kawasaki X-Patchwork-Id: 12948617 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C6A0C32771 for ; Fri, 19 Aug 2022 09:39:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348055AbiHSJjb (ORCPT ); Fri, 19 Aug 2022 05:39:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348179AbiHSJj3 (ORCPT ); Fri, 19 Aug 2022 05:39:29 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B42EB7F0B1 for ; Fri, 19 Aug 2022 02:39:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1660901965; x=1692437965; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4OWpSCTcZijPgiFp6MTHHj4KNHWiOMwVmdoA8J0Xfcc=; b=QMf7d/0PJo7QJlHzN6zQbvLFoSa4qb1LrLNiddXaXVNrd73vYbljmUN7 mHODzJtFfBiXElfs0OYKt0zz1+UZtDssgqjYUKBHXlUYv778Hw1gLY2L/ W5X3dylLXv3UcwR58FdKCyXTWDylONhf4/2QbT+8rwupm9NiVj6PB99xW ly6SlO6+VwTIIdpN8Iarv7fHapknXhjqEnsLHBTO+kN0Poi48njbcmNuX NiCSTNgMAwHypZllTnEuUSZ3QueztaLhrd5hcKFFK8wYsGO0qA8Dn9iEu s8l4WuW2r7cQR63MtvLU74Jp7g/jJZCYMVuJLubx9vAmQSZo3pduKdHLY A==; X-IronPort-AV: E=Sophos;i="5.93,247,1654531200"; d="scan'208";a="313411547" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 19 Aug 2022 17:39:25 +0800 IronPort-SDR: oPIWOi5gjOCsWrj+1tpmwXrNgKQMh1uV4hZ7epcT3RkW6+5QOeUr1D6UyH9krnWoO++IGAXgmV 5qlD32Adkrjih8DGLyjF01vLJS4xEBHxgeIosAEa/qKLNTTSJox1Ly1D5r3tsEDEFdcCE9uHvN RGM6TMeOMtLoonFaD+WBEPxPFgdcvHiB3J78zBK/Rv3W3M/vLN+jBLYFHg9L+Qt84OF0tmbFvV c7ub6+Mfmm20E4XjputhEXVtp7Aba09UxgWBQgTf9GI6TyptOMqvcHfPS+Mn6CZ4S16T8qkL20 rJt3krv3hUMQVPjpZc8xOCJl Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 19 Aug 2022 01:54:49 -0700 IronPort-SDR: SyLxo9eStl2n0jlQdZVNk54WmwiCwIxIPJXsm33H4fgx4xp0+ERKVZq39Y7qul4UpL1VNnDn7H o1uSCwXNkRVdciQM/f6fXgrIIzUZ7xphIRT1+SYpi3dZlEMk0EI3AX5f/2ld/d1rImsJ3xXG63 ZhjRGqBoAjFE3SFJ3GovzcbVRqKfzJzF3ZU4biHulkYGcD7Lgvo+AelJMz4yqYcydO5mCojY4L LCEgSuZZA09lB5nHes1jCwgzhUYm6hNzyMGiNM9wj15b1n3EU/trbc7ZGSyoiwd++LDFMbCuIv xrI= WDCIronportException: Internal Received: from shindev.dhcp.fujisawa.hgst.com (HELO shindev.fujisawa.hgst.com) ([10.149.52.207]) by uls-op-cesaip01.wdc.com with ESMTP; 19 Aug 2022 02:39:24 -0700 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org Cc: Bart Van Assche , Christoph Hellwig , Johannes Thumshirn , Shin'ichiro Kawasaki Subject: [PATCH blktests v3 2/6] nbd/rc: load nbd module explicitly Date: Fri, 19 Aug 2022 18:39:16 +0900 Message-Id: <20220819093920.84992-3-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220819093920.84992-1-shinichiro.kawasaki@wdc.com> References: <20220819093920.84992-1-shinichiro.kawasaki@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org After the commit "common/rc: avoid module load in _have_driver()", _have_driver() no longer loads specified module. However, nbd test cases and _have_nbd_netlink() function assume that the module is loaded by calling _have_driver(). This causes test case failures and unexpected skips. To fix them, load and unload modules explicitly in functions _start_nbd_server*(), _stop_nbd_server*() and _have_nbd_netlink(). Signed-off-by: Shin'ichiro Kawasaki Reviewed-by: Christoph Hellwig --- tests/nbd/rc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/nbd/rc b/tests/nbd/rc index 9c1c15b..32eea45 100644 --- a/tests/nbd/rc +++ b/tests/nbd/rc @@ -28,17 +28,21 @@ _have_nbd() { } _have_nbd_netlink() { + local ret=0 + if ! _have_nbd; then return 1 fi if ! _have_program genl-ctrl-list; then return 1 fi + modprobe -q nbd if ! genl-ctrl-list | grep -q nbd; then SKIP_REASONS+=("nbd does not support netlink") - return 1 + ret=1 fi - return 0 + modprobe -qr nbd + return $ret } _wait_for_nbd_connect() { @@ -62,6 +66,7 @@ _wait_for_nbd_disconnect() { } _start_nbd_server() { + modprobe -q nbd truncate -s 10G "${TMPDIR}/export" cat > "${TMPDIR}/nbd.conf" << EOF [generic] @@ -73,17 +78,20 @@ EOF _stop_nbd_server() { kill -SIGTERM "$(cat "${TMPDIR}/nbd.pid")" + modprobe -qr nbd rm -f "${TMPDIR}/nbd.pid" rm -f "${TMPDIR}/export" } _start_nbd_server_netlink() { + modprobe -q nbd truncate -s 10G "${TMPDIR}/export" nbd-server 8000 "${TMPDIR}/export" >/dev/null 2>&1 } _stop_nbd_server_netlink() { killall -SIGTERM nbd-server + modprobe -qr nbd rm -f "${TMPDIR}/export" } From patchwork Fri Aug 19 09:39:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinichiro Kawasaki X-Patchwork-Id: 12948618 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E0C0C32773 for ; Fri, 19 Aug 2022 09:39:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348179AbiHSJjc (ORCPT ); Fri, 19 Aug 2022 05:39:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348180AbiHSJj3 (ORCPT ); Fri, 19 Aug 2022 05:39:29 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24B997D1DE for ; Fri, 19 Aug 2022 02:39:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1660901967; x=1692437967; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TFET1SUx0caKxsTQyMuZvm0KziFkHquAoaowiYDawa0=; b=fFky4/lqpfoMcU6JVD7phHY8MYXaLWrPi/aRe+y5ZmrQjdmRHPwiBE16 boDDK7cHfLfrv7YpjZqWxxwdOMdaff3GVSBaPXdCj6H+MYpYMbRyxmFfY BU6wmn/2oudFc39tdNhYGVBBtK5dQErpJDj4gVtxHZqmnfUPRIsYJAHRQ 57nrmkuUTsRRpO3HCTbepZ/SN7CkhpF+/5uP/vmGRwT6Ww61Nens+Txi4 KaLqjIZIthxQJGG6X+L5Oak8z5/3RDaQ8bOOOStHgUsEjmM9SIZ4MIC6P 3XZEJDkRD9LVtcwJAXU6zB5s3d9aQzFWJwjfP/jhEcIZsCqr2N4YYy1yF g==; X-IronPort-AV: E=Sophos;i="5.93,247,1654531200"; d="scan'208";a="313411553" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 19 Aug 2022 17:39:26 +0800 IronPort-SDR: yJXmNzVxBC12axSwlsG5rEmoGvENjNSyCK+4Gkrm9MitVz9p0aWxc2kgtdhe0HgNg2kIPD4yTV VUY/cOah87W4rEBS27OjJZWEpwkpqiKOzgaie3QRM0Ybk9MArEa/b246yrgerVCDO/VsoODr86 dxe0IXrs1mUTiBPra/BEeQEOy+GRHKCbFD4+hGz9/2VuF6aVOMdFl0H3JOGaSzfOPtGzOfEJP4 1bMcoFeIPe0SMkpPNNgvHnAIa30fYCY/xYHeawDQS67ijW6gl+Q27PUhZ2OswYec9UYjOL3eJw dQqKm/bp8JGe2pS7tS3HjYVY Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 19 Aug 2022 01:54:50 -0700 IronPort-SDR: /D9zJMykwUde/D77kXcieIX9pS5inlqv19IKmnXaFCVn+cA2r+6PuXQVw5EieUDO1mC7BV0Pr3 KFS0bkhYW/V50fIXGCgqAesDc9HNoaY7dsJSosc5jFqPJ1QcS+RnjIaoNMG2NnrarLXVKeNY0C pz0yBW5Sxl7WslHrSgOBh3sV9SwMsqkJJRLtZTBKFNtDgWkvhisZIXpcxbtufHYRPBVCjd9uf1 8jfYUsj5XBJxrpLvjjWtwwIIYMoFLjpgK1/I/KLkCtN3r+syBR+0H58Q6UGBj+2XeiqtLPXQ1q dcY= WDCIronportException: Internal Received: from shindev.dhcp.fujisawa.hgst.com (HELO shindev.fujisawa.hgst.com) ([10.149.52.207]) by uls-op-cesaip01.wdc.com with ESMTP; 19 Aug 2022 02:39:25 -0700 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org Cc: Bart Van Assche , Christoph Hellwig , Johannes Thumshirn , Shin'ichiro Kawasaki Subject: [PATCH blktests v3 3/6] common/rc: ensure modules are loadable in _have_modules() Date: Fri, 19 Aug 2022 18:39:17 +0900 Message-Id: <20220819093920.84992-4-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220819093920.84992-1-shinichiro.kawasaki@wdc.com> References: <20220819093920.84992-1-shinichiro.kawasaki@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The commit e9645877fbf0 ("common: add a helper if a driver is available") introduced the helper function _have_driver() to check the driver or module is available no matter whether it is a loadable module or built-in module. It was assumed that _have_modules() whould check that specified modules are loadable and not built-in. However, the function _have_modules() returns true even if the specified modules are built-in and not loadable. This causes failures of some test cases on test system with built-in modules such as nbd/004. It also means that _have_modules() and _have_driver() have same functionality. To avoid the unexpected failures, fix _have_modules() to return false when the specified modules are built-in. Check if loadable module file exists by searching the module file path. If the module file does not exist, return false. Also add comments to describe the difference between _have_driver() and _have_modules(). Signed-off-by: Shin'ichiro Kawasaki Reviewed-by: Christoph Hellwig --- common/rc | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/common/rc b/common/rc index 5b34c60..8681a46 100644 --- a/common/rc +++ b/common/rc @@ -28,6 +28,22 @@ _have_root() { return 0 } +_module_file_exists() +{ + local ko_underscore=${1//-/_}.ko + local ko_hyphen=${1//_/-}.ko + local libpath + local -i count + + libpath="/lib/modules/$(uname -r)/kernel" + count=$(find "$libpath" -name "$ko_underscore" -o \ + -name "$ko_hyphen" | wc -l) + ((count)) && return 0 + return 1 +} + +# Check that the specified module or driver is available, regardless of whether +# it is built-in or built separately as a module. _have_driver() { local modname="${1//-/_}" @@ -41,12 +57,14 @@ _have_driver() return 0 } +# Check that the specified modules are available as loadable modules and not +# built-in the kernel. _have_modules() { local missing=() local module for module in "$@"; do - if ! modprobe -n -q "$module"; then + if ! _module_file_exists "${module}"; then missing+=("$module") fi done From patchwork Fri Aug 19 09:39:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinichiro Kawasaki X-Patchwork-Id: 12948619 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79F61C32771 for ; Fri, 19 Aug 2022 09:39:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348180AbiHSJjg (ORCPT ); Fri, 19 Aug 2022 05:39:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348063AbiHSJjb (ORCPT ); Fri, 19 Aug 2022 05:39:31 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2990790C78 for ; Fri, 19 Aug 2022 02:39:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1660901969; x=1692437969; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6obXhxhY9qtgAFL2tsIqRdOXxuO7TSXMR0YvdlunUPc=; b=aImxn/me67tflbvrHeHjvJHlh8eUv5zWtOoUvMJ6aNzya8ht7ux1pUbi 1dJtmpKn275kco1lgHWnjZXFtkHlyUrkFrMDEXnMNdKMaiHkkvRB81N+q lPpOf+i2T7lTanIvt3V/DvSgoc0ZEkNJ6k7LEKd5JpP1I+gfhy6LGGSwl wfm1qlv/Zk5DeJ44P/hw7gq8WC/NBKHgsU3uu10H7ewnF+jpixlgDmLCg oGPwD8JOWGMuPJ42UUY8PHxoPUES2zQ7DI+22MBFJyh+Ex7hqhorGBmDg tOBflok6n0S4zZ1WJ9GyBgDa3SzwPdwHgMlIp7ig7pB5DjGovQ8aTjjSE A==; X-IronPort-AV: E=Sophos;i="5.93,247,1654531200"; d="scan'208";a="313411561" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 19 Aug 2022 17:39:27 +0800 IronPort-SDR: UTgMsRgTaF+mP9RhMMUAb9HmVhLy40PQFdsYBdk9Gko8Zg4nTj9d7hJMCcYlHmjto4fct3WK72 BsX2Y1Wgr75ml6colyC9ds9kNAnh4Rv/zh4pT7rsYkpa7B+7qFLYN7w+etloO+53IhEDLumlle pE7FTz6M0AJLdtOolgAUOQimcdiZSneasWxMe3TafbUBe7llXpIy814mVh36qb1mmsIYZRdZZv q+lxac45ljZbHRrrFbJSiqJ2DDEYuI67CRe1wgVPGfgMV+rY6ZMVF3Gm1w0A0lg/F2COBCqtmf MHygIadpCE9rGX2rs1rLJy0N Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 19 Aug 2022 01:54:52 -0700 IronPort-SDR: 9sJNSC3nqmfKSxOWrUq2Wr0eB0Q6GDWtwMTpF2+ftb492luV81QW+YTeNKMZ0pXKKoe7GvDmO3 w8AQVLd5V92l3ix7kR5lVmrvjMYl2chszlJEqmrB8nqgpwXTHeSeLF6Zz0IMfPz9UPa5tK6lrM qqe8F++xN3lSyq2YPEjh1KD4A+TW3YrSpvkZk5FCsWKBMwWeVk4TnMTWV9kuQtFRN1BclNHYwz sQ6yGVEyub+0yrgSbMNHmMEqUXZESj/rdOJnPTKJkeZe1mj5CIztbcXSBxIr+Db4NcbuC0l8Mp 8Yc= WDCIronportException: Internal Received: from shindev.dhcp.fujisawa.hgst.com (HELO shindev.fujisawa.hgst.com) ([10.149.52.207]) by uls-op-cesaip01.wdc.com with ESMTP; 19 Aug 2022 02:39:27 -0700 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org Cc: Bart Van Assche , Christoph Hellwig , Johannes Thumshirn , Shin'ichiro Kawasaki Subject: [PATCH blktests v3 4/6] common,tests: replace _have_driver() with _have_drivers() Date: Fri, 19 Aug 2022 18:39:18 +0900 Message-Id: <20220819093920.84992-5-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220819093920.84992-1-shinichiro.kawasaki@wdc.com> References: <20220819093920.84992-1-shinichiro.kawasaki@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The helper function _have_driver() checks single driver but it is often required to check multiple drivers. Rename _have_driver() to _have_drivers() and improve it to check multiple drivers. This makes its usage consistent with _have_modules(). While at it, replace single brackets in _have_drivers() with double brackets to have consistent bracket style as _have_modules(). Signed-off-by: Shin'ichiro Kawasaki --- common/null_blk | 2 +- common/rc | 30 ++++++++++++++++++++---------- tests/nbd/rc | 2 +- tests/nvme/rc | 12 +++++------- tests/scsi/rc | 2 +- tests/zbd/009 | 2 +- tests/zbd/010 | 2 +- 7 files changed, 30 insertions(+), 22 deletions(-) diff --git a/common/null_blk b/common/null_blk index 52eb486..15bb35e 100644 --- a/common/null_blk +++ b/common/null_blk @@ -7,7 +7,7 @@ . common/shellcheck _have_null_blk() { - _have_driver null_blk + _have_drivers null_blk } _remove_null_blk_devices() { diff --git a/common/rc b/common/rc index 8681a46..fdeda24 100644 --- a/common/rc +++ b/common/rc @@ -42,15 +42,25 @@ _module_file_exists() return 1 } -# Check that the specified module or driver is available, regardless of whether -# it is built-in or built separately as a module. -_have_driver() -{ - local modname="${1//-/_}" +# Check that the specified modules or drivers are available, regardless of +# whether they are built-in or built separately as module files. +_have_drivers() { + local missing=() + local driver modname + + for driver in "$@"; do + modname=${driver//-/_} + if [[ ! -d "/sys/module/${modname}" ]] && + ! modprobe -qn "${modname}"; then + missing+=("$driver") + fi + done - if [ ! -d "/sys/module/${modname}" ] && - ! modprobe -qn "${modname}"; then - SKIP_REASONS+=("driver ${modname} is not available") + if [[ ${#missing} -gt 1 ]]; then + SKIP_REASONS+=("the following drivers are not available: ${missing[*]}") + return 1 + elif [[ ${#missing} -eq 1 ]]; then + SKIP_REASONS+=("${missing[0]} driver is not available") return 1 fi @@ -98,7 +108,7 @@ _have_module_param_value() { local expected_value="$3" local value - if ! _have_driver "$modname"; then + if ! _have_drivers "$modname"; then return 1; fi @@ -147,7 +157,7 @@ _have_src_program() { } _have_loop() { - _have_driver loop && _have_program losetup + _have_drivers loop && _have_program losetup } _have_blktrace() { diff --git a/tests/nbd/rc b/tests/nbd/rc index 32eea45..d3ec084 100644 --- a/tests/nbd/rc +++ b/tests/nbd/rc @@ -11,7 +11,7 @@ group_requires() { } _have_nbd() { - if ! _have_driver nbd; then + if ! _have_drivers nbd; then return 1 fi if ! _have_program nbd-server; then diff --git a/tests/nvme/rc b/tests/nvme/rc index ff13ea2..df13548 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -18,23 +18,21 @@ _nvme_requires() { _have_program nvme case ${nvme_trtype} in loop) - _have_driver nvme-loop + _have_drivers nvme-loop _have_configfs ;; pci) - _have_driver nvme + _have_drivers nvme ;; tcp) - _have_driver nvme-tcp - _have_driver nvmet-tcp + _have_drivers nvme-tcp nvmet-tcp _have_configfs ;; rdma) - _have_driver nvme-rdma - _have_driver nvmet-rdma + _have_drivers nvme-rdma nvmet-rdma _have_configfs _have_program rdma - _have_driver rdma_rxe || _have_driver siw + _have_drivers rdma_rxe || _have_drivers siw ;; *) SKIP_REASONS+=("unsupported nvme_trtype=${nvme_trtype}") diff --git a/tests/scsi/rc b/tests/scsi/rc index 3b4a33c..d9750c0 100644 --- a/tests/scsi/rc +++ b/tests/scsi/rc @@ -15,7 +15,7 @@ group_device_requires() { } _have_scsi_generic() { - _have_driver sg + _have_drivers sg } _require_test_dev_is_scsi() { diff --git a/tests/zbd/009 b/tests/zbd/009 index 483cbf6..4d6a637 100755 --- a/tests/zbd/009 +++ b/tests/zbd/009 @@ -33,7 +33,7 @@ have_good_mkfs_btrfs() { requires() { _have_fio - _have_driver btrfs + _have_drivers btrfs _have_module_param scsi_debug zone_cap_mb _have_program mkfs.btrfs _have_scsi_debug diff --git a/tests/zbd/010 b/tests/zbd/010 index 6d634b0..ef5e0fc 100644 --- a/tests/zbd/010 +++ b/tests/zbd/010 @@ -11,7 +11,7 @@ QUICK=1 requires() { _have_fio - _have_driver f2fs + _have_drivers f2fs _have_modules null_blk _have_module_param scsi_debug zone_cap_mb _have_program mkfs.f2fs From patchwork Fri Aug 19 09:39:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinichiro Kawasaki X-Patchwork-Id: 12948620 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54462C32771 for ; Fri, 19 Aug 2022 09:39:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348197AbiHSJjl (ORCPT ); Fri, 19 Aug 2022 05:39:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348187AbiHSJjb (ORCPT ); Fri, 19 Aug 2022 05:39:31 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB0EC7EFD8 for ; Fri, 19 Aug 2022 02:39:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1660901969; x=1692437969; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PqmQnyM3qKpwghVIz6xzLRKD6Pyldj2w2Y8ZoWnvYvQ=; b=bojP8H2oK5JLBkPIfKtap2uxtIju+5UwoXt7TQFp3cJCZUqF9OXEBYV7 kRLXWNn3olKxHwTog9fl2a9AOKKECN6YP0Ofp9yYtDDIqRmM4NX6G4jdK oe55ileHbhP/ihy5bqGNRDge7qDrjKCyuT0p0d1GohUud6g9c/2YY4KDe DDpyKW+7CeAvQq0mIJpkZLmpia9uswSY/WfqLRK/1L1/91CZnkznFPkEw h9/NMgGR2PeTw3i3E/mmkURkdHtTmD8lU0WfVeG0O8N4RvPE18kcoHkAX oEW8rU/OdvPh1PgSo1jd5NrEsfB5Xqdq1RBB2iGWquYc0cbVszI1kObhE Q==; X-IronPort-AV: E=Sophos;i="5.93,247,1654531200"; d="scan'208";a="313411569" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 19 Aug 2022 17:39:29 +0800 IronPort-SDR: 41QgVB17sAGI96/CO/e7KVEpaomTqMXwLwaKgaDD6XUwNM62J6Z9EvzsqKrVxtvU6dTR/90uVK mwpvLGGB5SQolnaI82DLL5wH5UabBbUOk+ROxsmFW8bKiXv18WvwcCFK6AO8GHRhOafkGlLNYD furBh0iW+YSSUeSrzaCmw6cRJIEeNUF5VXVTEW4N/uYjq3+NkYuiFnARbWUMRCh5dNCimqTwiL Ilwy9PWK1/mp+yV0oH9lSMBgJiQzJurb1YuzFO63SdHfOJKDMmGmV1DmT8lOCFczWfrebOH8AN NvoaI0zNNiXtbZ0RWjy2JGrC Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 19 Aug 2022 01:54:53 -0700 IronPort-SDR: SIfoVuw7uc5zpyNzMCE4cUxI1SJbqXy6oHsud+DpDgpuRY6mSzxaKuuSVTSNwAA5WV4ProztD3 uCrJrRoziED3MwPqF+G5eOygXd2eWxl7SKYvSztiaeO3HT7/x/lZFoltoFVbWwgwzI5tbVijJU Pzln0iGDEsHWJ0fd4aj0cwljobryk8NH83O8D5nd0fihUictMWVKuS1Nl4q4GVqljuWyHD7V9d kMEXB+K2r5lbs5y0fxeyHLo0eBMuO+pTXInFuVJLEhv1Y7lXtzliAiIPKAKxDG1wQ9kDZgBKqP ztw= WDCIronportException: Internal Received: from shindev.dhcp.fujisawa.hgst.com (HELO shindev.fujisawa.hgst.com) ([10.149.52.207]) by uls-op-cesaip01.wdc.com with ESMTP; 19 Aug 2022 02:39:28 -0700 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org Cc: Bart Van Assche , Christoph Hellwig , Johannes Thumshirn , Shin'ichiro Kawasaki Subject: [PATCH blktests v3 5/6] block/001: use _have_drivers() in place of _have_modules() Date: Fri, 19 Aug 2022 18:39:19 +0900 Message-Id: <20220819093920.84992-6-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220819093920.84992-1-shinichiro.kawasaki@wdc.com> References: <20220819093920.84992-1-shinichiro.kawasaki@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The drivers sd_mod and sr_mod do not need to be loadable. Replace the check with _have_drivers() and allow test with built-in modules. Signed-off-by: Shin'ichiro Kawasaki --- tests/block/001 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/block/001 b/tests/block/001 index 5f05fa8..a84d0a1 100755 --- a/tests/block/001 +++ b/tests/block/001 @@ -13,7 +13,8 @@ DESCRIPTION="stress device hotplugging" TIMED=1 requires() { - _have_scsi_debug && _have_modules sd_mod sr_mod + _have_scsi_debug + _have_drivers sd_mod sr_mod } stress_scsi_debug() { From patchwork Fri Aug 19 09:39:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinichiro Kawasaki X-Patchwork-Id: 12948621 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3118C32773 for ; Fri, 19 Aug 2022 09:39:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348181AbiHSJjo (ORCPT ); Fri, 19 Aug 2022 05:39:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348182AbiHSJjc (ORCPT ); Fri, 19 Aug 2022 05:39:32 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4229A027D for ; Fri, 19 Aug 2022 02:39:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1660901971; x=1692437971; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2uAqIfzOKDqs4gxcCMklpEVom5aqGpSZ0EJpRYPFlqY=; b=K149mNOUb7ktoEc7MntGESipC13wu/pMn+kShA42jSntnEujnrbmSKfi 8UtLhNqHoWO4snw+++7v4fYj1PPFUnzdYjspXCvy+rtWTK7XSz5fjIcH/ lcVhI/kseYf4Fimo0CNEbqpQQ7mXY4h0nMDk01X+rd5Tp5D0bNmr3X0+L H+uj+IWLmfeDn3IcBUwEWOtgP71MM4gNVa8q1j0ZpGz+VFbOtJFjGHWzh KDVE6nCR3TjLv4on2asD/tkdY3aaZ16jvuHbMxNae/xC3EgpSr6UEl7pc Pm3YfErYMGoX4TDYbQ8/JTe0m/iyPW7nLG2sUpOVqn/UfGmX0tYqCctQu Q==; X-IronPort-AV: E=Sophos;i="5.93,247,1654531200"; d="scan'208";a="313411574" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 19 Aug 2022 17:39:30 +0800 IronPort-SDR: NYnlAyrzeLUsPLMShlyVjnh8GkBMayHE69Lx+vFQvNf5X2xW3mY2W2gvRE5kK3evcPRI54xhPH MIqvpizae4oLrKzVcjtOPH1V5jk//mpi8WCWk9T9qNmNgDzfgejKXfEN145FhCsf6j7c2mLl+J wYh1CSvNFv3L5T0ympNl2GTWQPeXBUAN7pT9i4ihRyt43bb8w/85AaeVUJXcfR+/YvIBVcny4J 2CtFYdnIt8QTjg3hsAsZ14OXvfq2tXpHHWoChtSpk+10LTHyY1v0f8o8GGC0N75Pb/60HRfLTH FGRxuUZryEb2vgeoEOqTLafY Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 19 Aug 2022 01:54:55 -0700 IronPort-SDR: Fbzz4gvkCf9qs8erT0c8dbqkJQEJtBTlf/ZIx+4RZe5GNALQNk8Mbn88ZLX1ucSCkPGZx18azL 72VEgVTEbuWI/1beIHO4iwAEelOC35/N/iN2DmHx1We64y13Kuog5fZdmPHeNQdG20c+nX6aji qYKpb4Q1FGv0HKoSYqJk1xvAG76URmqPc+8qQqP0FCEt/5LjDVde60zOU/0rA2TMeAhCmwsQgn X93io/OGrT8TZoyvKmI85CZGOHyQjn26yx4o4xcHmYcaz6orEd3A6RQ/5uFJYyFvyMSatId7bz qls= WDCIronportException: Internal Received: from shindev.dhcp.fujisawa.hgst.com (HELO shindev.fujisawa.hgst.com) ([10.149.52.207]) by uls-op-cesaip01.wdc.com with ESMTP; 19 Aug 2022 02:39:29 -0700 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org Cc: Bart Van Assche , Christoph Hellwig , Johannes Thumshirn , Shin'ichiro Kawasaki Subject: [PATCH blktests v3 6/6] srp/rc: allow test with built-in sd_mod and sg drivers Date: Fri, 19 Aug 2022 18:39:20 +0900 Message-Id: <20220819093920.84992-7-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220819093920.84992-1-shinichiro.kawasaki@wdc.com> References: <20220819093920.84992-1-shinichiro.kawasaki@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The srp test group can be executed with built-in sd_mod and sg drivers. Check the drivers with _have_drivers() in place of _have_modules. Signed-off-by: Shin'ichiro Kawasaki Reviewed-by: Bart Van Assche --- tests/srp/rc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/srp/rc b/tests/srp/rc index 94ee97c..a3a96a7 100755 --- a/tests/srp/rc +++ b/tests/srp/rc @@ -35,6 +35,7 @@ group_requires() { SKIP_REASONS+=("LIO must be unloaded before the SRP tests are run") return fi + _have_drivers sd_mod sg required_modules=( dm_multipath dm_queue_length @@ -51,9 +52,6 @@ group_requires() { scsi_dh_alua scsi_dh_emc scsi_dh_rdac - sd_mod - sd_mod - sg target_core_iblock target_core_mod )