From patchwork Fri Sep 2 03:45:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinichiro Kawasaki X-Patchwork-Id: 12963604 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 4B3F5ECAAA1 for ; Fri, 2 Sep 2022 03:45:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233680AbiIBDp1 (ORCPT ); Thu, 1 Sep 2022 23:45:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235307AbiIBDpX (ORCPT ); Thu, 1 Sep 2022 23:45:23 -0400 Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DF371EC4D for ; Thu, 1 Sep 2022 20:45:19 -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=1662090320; x=1693626320; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+hi6RyCKfTtr3DMi2eEnpO/6akt85B6JcggBgLY6cew=; b=DNRAgxg6XIMD8CrxTx6iHgKAG3yoOfEM1We5u9pLq7zjNbHDdlqtLrnb pWmXjO5Lm58n7MixC5xNecPUZ7ehFhL70lfYf/pLmGgRYhnPA5hVGXpco upOOlK0YhHXYGYOhArPdjyYAmni8i8CK8RHDoDERGADeAHVgJi9F33wYI LZrUl8du4yXY/0lyvm8GoBJuTgufW6QkwKxE5lB+QQ5krw8iel66/o79A WCpyQ5REuvZ2CLdq2A9S56sWtFmbGBT53+BBTNm0Ve3I1i4dhRSfHqlfY zrcKFtT72DVEX60TRTsID1mfCIBAzN0r8U4pwcofwdNr7qkvMifgrrtKO w==; X-IronPort-AV: E=Sophos;i="5.93,281,1654531200"; d="scan'208";a="322404159" 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; 02 Sep 2022 11:45:19 +0800 IronPort-SDR: 1y48n6aIlCx5wsZ5MD6TC2cFfzBbyIIONf0CpxYXd8YLvNsIc+u74A/V6J8U2Y9scCGEc0vdrs B6vYpfNUBzgp1JGuVxG/lRmnqyKQ1ccUXwFByzuOSr8RDDQxV9qNQ9k2PGzt0vp1NZgLISmqxO MrbuUhEPyGxfepqlCNh0m7tk3bMD2XszYflt7n4iJGXCqdSMz/pq0LMwzMyBb/gc7Vs+C/nM3+ Xz2y0fX8S4bdXiBhXQ7mBuIH+RY7Xh9dNfHODt0h79sA7jgtWWtZ7+7iKPu8sFeeSNRmsngV4G g4k0weLfY5Zod7Rn9f+ElGQf Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 01 Sep 2022 20:05:47 -0700 IronPort-SDR: hpwv2grAuwVZ0rFra5IhIGAnxGJKzDRSzO9djJw/mIuoPSZ/q6/zyeM31nH5NTWnfqPHQpxTg/ pMvMThq+978EL8ko0vZdShBaWn/RON+C0BbmnQgWz6kTFx2OS5L1Tcz138ZYcnInMA2fxKbHcX etpiJ9emeT0mTCvBfzSNcmX5OTk4XJKIPAVtaz0L1QAv6GfgAc2frqXLf8ol+VSXP362bS86+5 cIasu/nyInXWZP1cB2Wz1laAPVOFX6OoJNj56eUs96GbL0KJ9168gCQwrxvpqAY2UWrRXG29AV PNg= WDCIronportException: Internal Received: from shindev.dhcp.fujisawa.hgst.com (HELO shindev.fujisawa.hgst.com) ([10.149.52.207]) by uls-op-cesaip02.wdc.com with ESMTP; 01 Sep 2022 20:45:18 -0700 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org Cc: Christoph Hellwig , Bart Van Assche , Sagi Grimberg , Chaitanya Kulkarni , Johannes Thumshirn , Shin'ichiro Kawasaki Subject: [PATCH blktests 1/5] check: clean up _run_test() Date: Fri, 2 Sep 2022 12:45:12 +0900 Message-Id: <20220902034516.223173-2-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220902034516.223173-1-shinichiro.kawasaki@wdc.com> References: <20220902034516.223173-1-shinichiro.kawasaki@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Avoid duplicated declarations and returns of local variable 'ret' in _run_test(). This is a preparation for a following commit. Signed-off-by: Shin'ichiro Kawasaki --- check | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/check b/check index e6c321c..85e0569 100755 --- a/check +++ b/check @@ -447,6 +447,8 @@ _run_test() { RUN_FOR_ZONED=0 FALLBACK_DEVICE=0 + local ret=0 + # Ensure job control monitor mode is off in the sub-shell for test case # runs to suppress job status output. set +m @@ -461,14 +463,13 @@ _run_test() { RESULTS_DIR="$OUTPUT/nodev" _call_test test - local ret=$? + ret=$? if (( RUN_ZONED_TESTS && CAN_BE_ZONED )); then RESULTS_DIR="$OUTPUT/nodev_zoned" RUN_FOR_ZONED=1 _call_test test ret=$(( ret || $? )) fi - return $ret else if [[ ${#TEST_DEVS[@]} -eq 0 ]] && \ declare -fF fallback_device >/dev/null; then @@ -494,7 +495,6 @@ _run_test() { requires fi - local ret=0 for TEST_DEV in "${TEST_DEVS[@]}"; do TEST_DEV_SYSFS="${TEST_DEV_SYSFS_DIRS["$TEST_DEV"]}" TEST_DEV_PART_SYSFS="${TEST_DEV_PART_SYSFS_DIRS["$TEST_DEV"]}" @@ -523,9 +523,9 @@ _run_test() { unset "TEST_DEV_PART_SYSFS_DIRS[${TEST_DEVS[0]}]" TEST_DEVS=() fi - - return $ret fi + + return $ret } _run_group() { From patchwork Fri Sep 2 03:45:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinichiro Kawasaki X-Patchwork-Id: 12963605 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 9A240C6FA81 for ; Fri, 2 Sep 2022 03:45:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232014AbiIBDp2 (ORCPT ); Thu, 1 Sep 2022 23:45:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235324AbiIBDpY (ORCPT ); Thu, 1 Sep 2022 23:45:24 -0400 Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D16921E2E for ; Thu, 1 Sep 2022 20:45:21 -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=1662090322; x=1693626322; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KfkrzAmmWHHAh0R5vMDd/q87eehsr4Uhga/alYF3tuU=; b=aMopikGLzkb2l+eUOjgWySK4/tX/3CsTz+cVbS8JJtvKENA19SLXUcyq GiHCuzlgc4hH+g6ZvER3ksv4IduC3DSoiYAPSC2DZPKFqGCtV2HoBuWuG Q3MKT5SyLLGo11PQYbxqYXXSJOiuuzi6K+oFQs5LAKZCodrf/l+cfc2zc FB8MRkMTGqiCE6iubnUk63eZcWXR00Ere6uJ0trIkOIjS193p0Hqc/0uZ AeXFoUrp5/wDrI47M+K9Y8o+hGO2kZU1Y97os3RVkY81joXzq0OPOTLXA ZMwqLAoWPM7DjgFE+D0cbPVes5ycd1eqYZ3Q4cO1THcAEAGFZr7K/7tC+ Q==; X-IronPort-AV: E=Sophos;i="5.93,281,1654531200"; d="scan'208";a="322404163" 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; 02 Sep 2022 11:45:20 +0800 IronPort-SDR: AKAIpoGdrzOz9rCu2SNXVDrmo+X73r+5tE6OEP3YWWckLUsunTGeu+deBN+ckt8regF5AcaNEp wviQWIe6sVK6Dq2jf5KLeqN2MSNluOLxNlonpqFnRyi9FDsR8ufO0NLnOTvr7YEnE5biAYNZal PvSblSJqZ+1ZLhABOEN1VQDX3VE2hkjmYcqzEEvrBUZqCYQmQnVaA2nDnG9LeW8RSs4lhquwV+ 8MOO21sB7Ui14pcXHo7wBfnyDIMBYlD1nwoOhDrjuTPKMR4MsOgID0nyzk1M4+3/cMH6044cwB SF9xevsJYWh0Wb0FjsxnAHfV Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 01 Sep 2022 20:05:49 -0700 IronPort-SDR: hJwvAZOsgKXqTQon1pv88bjPHwaONozkq8LTZgLtIC3t95r5aUbJ1ZYEE9O4AuIn3u7Nq/PGMA zUW/d5aO9drcQLs26GgkUy0kB1T0IHNb9JbLhIoUffFl1DLRO0VaF9u3cCQX4aoXPp8Vhy4dxN z20geQTmrttRhs6F4LzI8r+nakRAYMoAL4QFgu/L/+62pRXlTB8BdwvdAWlJv+dUIKerMZCTEP xJPsYujy3abQRUxCNRZnFKkfZZvFO/tPIpQvdFPiKUPhfUdtHTqbUIgvRey/E/MCn0qs0/SYmn OwE= WDCIronportException: Internal Received: from shindev.dhcp.fujisawa.hgst.com (HELO shindev.fujisawa.hgst.com) ([10.149.52.207]) by uls-op-cesaip02.wdc.com with ESMTP; 01 Sep 2022 20:45:20 -0700 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org Cc: Christoph Hellwig , Bart Van Assche , Sagi Grimberg , Chaitanya Kulkarni , Johannes Thumshirn , Shin'ichiro Kawasaki Subject: [PATCH blktests 2/5] common,tests: rename unload_module() to _unload_module() Date: Fri, 2 Sep 2022 12:45:13 +0900 Message-Id: <20220902034516.223173-3-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220902034516.223173-1-shinichiro.kawasaki@wdc.com> References: <20220902034516.223173-1-shinichiro.kawasaki@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org All helper functions in common/rc have underscore prefix except unload_module(). Add the prefix to it. Signed-off-by: Shin'ichiro Kawasaki --- common/multipath-over-rdma | 4 ++-- common/rc | 2 +- tests/nvmeof-mp/rc | 12 ++++++------ tests/srp/rc | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/common/multipath-over-rdma b/common/multipath-over-rdma index c1c2e7c..fb820d6 100644 --- a/common/multipath-over-rdma +++ b/common/multipath-over-rdma @@ -428,11 +428,11 @@ stop_soft_rdma() { echo "$i ..." rdma link del "${i}" || echo "Failed to remove ${i}" done - if ! unload_module rdma_rxe 10; then + if ! _unload_module rdma_rxe 10; then echo "Unloading rdma_rxe failed" return 1 fi - if ! unload_module siw 10; then + if ! _unload_module siw 10; then echo "Unloading siw failed" return 1 fi diff --git a/common/rc b/common/rc index be69a4d..738a32f 100644 --- a/common/rc +++ b/common/rc @@ -385,7 +385,7 @@ _uptime_s() { } # Arguments: module to unload ($1) and retry count ($2). -unload_module() { +_unload_module() { local i m=$1 rc=${2:-1} [ ! -e "/sys/module/$m" ] && return 0 diff --git a/tests/nvmeof-mp/rc b/tests/nvmeof-mp/rc index ed27b5c..4238a4c 100755 --- a/tests/nvmeof-mp/rc +++ b/tests/nvmeof-mp/rc @@ -162,12 +162,12 @@ start_nvme_client() { } stop_nvme_client() { - unload_module nvme-rdma || return $? - unload_module nvme-fabrics || return $? + _unload_module nvme-rdma || return $? + _unload_module nvme-fabrics || return $? # Ignore nvme and nvme-core unload errors - this test may be run on a # system equipped with one or more NVMe SSDs. - unload_module nvme >&/dev/null - unload_module nvme-core >&/dev/null + _unload_module nvme >&/dev/null + _unload_module nvme-core >&/dev/null return 0 } @@ -267,8 +267,8 @@ stop_nvme_target() { rmdir "$d" done ) - unload_module nvmet_rdma && - unload_module nvmet && + _unload_module nvmet_rdma && + _unload_module nvmet && _exit_null_blk } diff --git a/tests/srp/rc b/tests/srp/rc index 23f87e4..55b535a 100755 --- a/tests/srp/rc +++ b/tests/srp/rc @@ -325,14 +325,14 @@ stop_srp_ini() { log_out for ((i=40;i>=0;i--)); do remove_mpath_devs || return $? - unload_module ib_srp >/dev/null 2>&1 && break + _unload_module ib_srp >/dev/null 2>&1 && break sleep 1 done if [ -e /sys/module/ib_srp ]; then echo "Error: unloading kernel module ib_srp failed" return 1 fi - unload_module scsi_transport_srp || return $? + _unload_module scsi_transport_srp || return $? } # Associate the LIO device with name $1/$2 with file $3 and SCSI serial $4. @@ -491,7 +491,7 @@ start_lio_srpt() { if modinfo ib_srpt | grep -q '^parm:[[:blank:]]*rdma_cm_port:'; then opts+=("rdma_cm_port=${srp_rdma_cm_port}") fi - unload_module ib_srpt + _unload_module ib_srpt modprobe ib_srpt "${opts[@]}" || return $? i=0 for r in "${vdev_path[@]}"; do @@ -553,7 +553,7 @@ stop_lio_srpt() { target_core_file target_core_stgt target_core_user \ target_core_mod do - unload_module $m 10 || return $? + _unload_module $m 10 || return $? done } From patchwork Fri Sep 2 03:45:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinichiro Kawasaki X-Patchwork-Id: 12963606 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 CE11BC6FA82 for ; Fri, 2 Sep 2022 03:45:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233616AbiIBDp3 (ORCPT ); Thu, 1 Sep 2022 23:45:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235354AbiIBDpY (ORCPT ); Thu, 1 Sep 2022 23:45:24 -0400 Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC5602657B for ; Thu, 1 Sep 2022 20:45: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=1662090323; x=1693626323; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bnrwBntC+0AO69BK55AhoSUSUKxNSUoTxHX6DmLeRfo=; b=fO5YzjGE7VIi7wwNKXXFXdtjyHD38BChh7P3NP0lI3V5M+NA6qCRNSA9 a6U0HzT35e+XufkF8M/OpsH0Rmo/KTrtkHnOZYfZH7OCNAov+g0oxX9Ci te2uB131GAINIstRI5Ug60ag6r7FZxXUYB/T4cqdSDVZL7L2wqWDL0Fls jhzoBVErlCMdEoEvzf9XjcwbJyKJtq0lwEPCQ9ijOIvhb9ruCBeHK04Bg ZvpXtcmXxs0TMmYgW22F1ANOfx5FNZshTXK6dK8WI9BT4bfPetMMMkc8V bKX3eAxBeII2KagMl9eghlxT8PKcsL66P+jPzCqU2fylYDau87QPREU/w g==; X-IronPort-AV: E=Sophos;i="5.93,281,1654531200"; d="scan'208";a="322404166" 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; 02 Sep 2022 11:45:22 +0800 IronPort-SDR: ob+q8hUo20Q+TNkBdBhRc3ZdM84yqga9oI5kZEoCxv2mV992IsBiAKa7MvXcBmrEpKPJuBJaD/ OQYzzjqr/trBVyf66DcztYHMI79ckWSS+4e35ajeElYD1iS7ywrukHPjkAWsxnN7OT4sq+qVDs 4N1D2JOqYSMbo1Oo8gmQPzRpcBnAGAHoRmxuyVZR0W65uXV9GSTLSXK2Nj7NDPaZgTJfzQJsoz +c6rBZ+uopzbLWAYA1E1U951dvUZTjQomKs9Z/0tUlgog0tWzzmxVVCS1z3ylAkHmaj4jXD17c gGTsNwiBTcRMjos7I69cRB33 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 01 Sep 2022 20:05:50 -0700 IronPort-SDR: Na+BpTetnNNKUUrUtD9L4FUtUjubuKmy7A8dJA8tgnl7SxVWg1yqx58/iCb5MVGfB+HJRzigwQ szFZ0si7dcsa+qTKUu1JXudjCyzoJLL+GzqHjrnM94buYwqpdJJ6LPD2L0uDWcorr2WDJdvlPF Q4X4XwNZygua1Fd6/YnguoWNyRK4fJtm9YHxIN3KXyQ12d8XsamBdloucSiCEQV5MyFzuwofAg HiIWOrElf4eI6+Hb7ZWvaG2XOXbcS6PP3+d1oVUxWkAd94LVw4yCN+qFzcqXjS2DVCwyEioM9L 9b0= WDCIronportException: Internal Received: from shindev.dhcp.fujisawa.hgst.com (HELO shindev.fujisawa.hgst.com) ([10.149.52.207]) by uls-op-cesaip02.wdc.com with ESMTP; 01 Sep 2022 20:45:21 -0700 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org Cc: Christoph Hellwig , Bart Van Assche , Sagi Grimberg , Chaitanya Kulkarni , Johannes Thumshirn , Shin'ichiro Kawasaki Subject: [PATCH blktests 3/5] check,common/rc: move _unload_module() from common/rc to check Date: Fri, 2 Sep 2022 12:45:14 +0900 Message-Id: <20220902034516.223173-4-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220902034516.223173-1-shinichiro.kawasaki@wdc.com> References: <20220902034516.223173-1-shinichiro.kawasaki@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org To use in the 'check' script in the following commit, move the helper function _unload_module() from 'common/rc' to 'check'. Signed-off-by: Shin'ichiro Kawasaki --- check | 13 +++++++++++++ common/rc | 13 ------------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/check b/check index 85e0569..5f57386 100755 --- a/check +++ b/check @@ -439,6 +439,19 @@ _test_dev_is_zoned() { $(cat "${TEST_DEV_SYSFS}/queue/zoned") != none ]] } +# Arguments: module to unload ($1) and retry count ($2). +_unload_module() { + local i m=$1 rc=${2:-1} + + [ ! -e "/sys/module/$m" ] && return 0 + for ((i=rc;i>0;i--)); do + modprobe -r "$m" + [ ! -e "/sys/module/$m" ] && return 0 + sleep .1 + done + return 1 +} + _run_test() { TEST_NAME="$1" CAN_BE_ZONED=0 diff --git a/common/rc b/common/rc index 738a32f..9bc0dbc 100644 --- a/common/rc +++ b/common/rc @@ -384,19 +384,6 @@ _uptime_s() { awk '{ print int($1) }' /proc/uptime } -# Arguments: module to unload ($1) and retry count ($2). -_unload_module() { - local i m=$1 rc=${2:-1} - - [ ! -e "/sys/module/$m" ] && return 0 - for ((i=rc;i>0;i--)); do - modprobe -r "$m" - [ ! -e "/sys/module/$m" ] && return 0 - sleep .1 - done - return 1 -} - _have_writeable_kmsg() { if [[ ! -w /dev/kmsg ]]; then SKIP_REASONS+=("cannot write to /dev/kmsg") From patchwork Fri Sep 2 03:45: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: 12963608 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 6CCDDECAAD2 for ; Fri, 2 Sep 2022 03:45:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233769AbiIBDpa (ORCPT ); Thu, 1 Sep 2022 23:45:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235356AbiIBDp1 (ORCPT ); Thu, 1 Sep 2022 23:45:27 -0400 Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5F541EAD6 for ; Thu, 1 Sep 2022 20:45:24 -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=1662090324; x=1693626324; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RLRiQgEDMy2HV4ND1KbrWwYnIjENVIT1saTaZ5sA81U=; b=XLVssJDG8HaE/UegELjreXnIV29t6RHKHAVJjJqsYtgve/MHnd+pAXl1 T2avarGlXdTXA5M3hAhbWZ/8nsifLl6FPcbgy13Nq2yo1KKb7omCSULOV 3aMhRwZUCFnjO7Ir3/2llGPmJNrw4dEQINRG80MjM46pduUN2IlHRAVyZ j0KoNzkKNWqHriZ5eJvA8Dl/PUuwIKhS2Zo0UAmfWMfDq+6oW9AffqGnE Byszi7vnwfYAjlTs2IzMyhebwgx9Ym7iq/nA4+CIYcoie4hwtB6mVjvn/ wksCm5tQM8teHfHirmukzh0xRWG3dN3rqH/jHDYatiKFFa5dmpFgSEcfm A==; X-IronPort-AV: E=Sophos;i="5.93,281,1654531200"; d="scan'208";a="322404168" 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; 02 Sep 2022 11:45:23 +0800 IronPort-SDR: RrxPFc9F19i2NGdZ4DCQyNAX0ZqqVpjkDU0XoVj8k0ODgZzWFsKFS9qdXFSgvHrstBimxLSUpQ Ttz0hlBMAl+tOiDi7F9y0S64SSlb4jQEiaOtTj7g6IeIyLMqvObUzZbXfssJcbbj7uxuYm5q/r Hf7WMlkf2Qwxt+h1xl3AHVnwEOjVgPeaaRAc5A80BojB+qEDeXW4IBW3n8HbgFdH+Dff4VtFC4 xVfe+xuzkgRTKnGqys8UxV7Pk7YT4vHgj6/6ZN9RXF+drMhyC8yBLweIUtkCOEFuoC6A6oBieR Q+WVzX1lbct/LDBoCi7GNQHV Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 01 Sep 2022 20:05:51 -0700 IronPort-SDR: 7rPdPEpbF52LM+k19JdXfxw3W5JoHI69B0jlDSFzm7KdqxVQTqZkmYLA6cUDVDOMFLdux9T0vY SmMepXKOukRlcEuJrmSDRZp7MN08IXhw1aDiKNp8zOtCtRTaed5iHNOVIbzEU8NP6bKfBBTr+Z xIOaVkWQrNRl95Gp49VjGFCm7fd4Vq50S/Kst1nxwA+WHeVAp8MAjZYxqaHqFLlcAP4XZ6SdBD 83G/YISnA0C2ov/iYEDI+/OeSaJ0Fr+/nOT2isZYxGomOZfsxlzYPO6dROJcK5C033LAAOz8+d 5Mg= WDCIronportException: Internal Received: from shindev.dhcp.fujisawa.hgst.com (HELO shindev.fujisawa.hgst.com) ([10.149.52.207]) by uls-op-cesaip02.wdc.com with ESMTP; 01 Sep 2022 20:45:22 -0700 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org Cc: Christoph Hellwig , Bart Van Assche , Sagi Grimberg , Chaitanya Kulkarni , Johannes Thumshirn , Shin'ichiro Kawasaki Subject: [PATCH blktests 4/5] check,common/rc: load module in _have_driver() and unload after test Date: Fri, 2 Sep 2022 12:45:15 +0900 Message-Id: <20220902034516.223173-5-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220902034516.223173-1-shinichiro.kawasaki@wdc.com> References: <20220902034516.223173-1-shinichiro.kawasaki@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The commit 06a0ba866d90 ("common/rc: avoid module load in _have_driver()") removed module load from _have_driver(). However, it was pointed out no module load in _have_driver() is confusing and adds complexity [1]. It requires explicit module loads and unloads in number of test cases. The module unloads must be checked if unload is safe or not. Also module load error must be handled. To avoid these complexity, a new helper function would be required, but it will be look like the _have_driver() with module load. Then revert back the feature to load module in _have_driver(). To address the issue that the commit 06a0ba866d90 tried to fix, record the modules loaded by _have_driver() in MODULES_TO_UNLOAD array. Unload the recorded modules after each test case processing completed. This avoids the side-effect by the modules loaded by _have_driver(). [1] https://lore.kernel.org/linux-block/89aedf1d-ae08-adef-db29-17e5bf85d054@grimberg.me/ Fixes: 06a0ba866d90 ("common/rc: avoid module load in _have_driver()") Signed-off-by: Shin'ichiro Kawasaki --- check | 13 +++++++++++++ common/rc | 13 ++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/check b/check index 5f57386..34e96c4 100755 --- a/check +++ b/check @@ -452,6 +452,16 @@ _unload_module() { return 1 } +_unload_modules() { + local i + + for ((i=${#MODULES_TO_UNLOAD[@]}; i > 0; i--)); do + _unload_module "${MODULES_TO_UNLOAD[i-1]}" 10 + done + + unset MODULES_TO_UNLOAD +} + _run_test() { TEST_NAME="$1" CAN_BE_ZONED=0 @@ -459,6 +469,7 @@ _run_test() { DMESG_FILTER="cat" RUN_FOR_ZONED=0 FALLBACK_DEVICE=0 + MODULES_TO_UNLOAD=() local ret=0 @@ -538,6 +549,8 @@ _run_test() { fi fi + _unload_modules + return $ret } diff --git a/common/rc b/common/rc index 9bc0dbc..a764b57 100644 --- a/common/rc +++ b/common/rc @@ -43,17 +43,24 @@ _module_file_exists() } # Check that the specified module or driver is available, regardless of whether -# it is built-in or built separately as a module. +# it is built-in or built separately as a module. Load the module if it is +# loadable and not yet loaded. In this case, the loaded module is unloaded at +# test case end regardless of whether the test case is skipped or executed. _have_driver() { local modname="${1//-/_}" - if [ ! -d "/sys/module/${modname}" ] && - ! modprobe -qn "${modname}"; then + if [ -d "/sys/module/${modname}" ]; then + return 0 + fi + + if ! modprobe -q "${modname}"; then SKIP_REASONS+=("driver ${modname} is not available") return 1 fi + MODULES_TO_UNLOAD+=("${modname}") + return 0 } From patchwork Fri Sep 2 03:45: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: 12963607 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 64E4DC6FA83 for ; Fri, 2 Sep 2022 03:45:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235307AbiIBDp3 (ORCPT ); Thu, 1 Sep 2022 23:45:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235357AbiIBDp1 (ORCPT ); Thu, 1 Sep 2022 23:45:27 -0400 Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45B602A24F for ; Thu, 1 Sep 2022 20:45: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=1662090325; x=1693626325; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Vk0eJ8lsz1a98jZ70czxJnVa9yr/83zvWoTmuaOaYEo=; b=cK+E2qZdg26lfQSd4py2y4CvBQ7SJf/kCPr1Ysh5KI0aam+0TEFOW12t cl5Llz77LsCcKVpZgPrJ/ldv/W/Phf+nm1fO2znSXhJklS6y0irC/kg68 zfQD04UwMrNIW48GHaaoOrj7vDCjt1dKe11dySPnuLs4COgVrDhnNE+9o bl/mz6LtIFtf35y58w/w1htKUE8S32ZSIjaBFKkfZHA7PZa8AB5NsQ80e mWJZRfl7EybZ4uq/UatWAKeZm2hoK389EvMeTVrExAb8z+wXj2G/3Yv61 2gH0p8FY/ZBPKNvWWJU6n6t5hV/MX5VYFrLESADVXBspacPIBDxrqly84 g==; X-IronPort-AV: E=Sophos;i="5.93,281,1654531200"; d="scan'208";a="322404169" 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; 02 Sep 2022 11:45:24 +0800 IronPort-SDR: vJdordwn4qEvDk/zVPulSZWJeOQkTpHGI6faev4uRKBhjensMi5jA5FFwbH4oruqlSk/gWUW0y aYT0CUgPSKudnW5w5Z3hx6qOVULnfPEwC7LUqaVLXGVz8SzYQ12Aw1vSkKhmOBGhi3hMzO2VtR ZBAuPO6/y+2GoGXygJkUEf5RDZ2lwJqFSw6lSmzTmZV2V/V0ZXK4HF6tID/iapl7mJXyDxVdh9 eyTqqwwjI32cQmtQiAY2opotdHT0RBaYRN9ntWn3+gsK1L9jEk08loexWGtr3rYgDAoXtAvtaK 6ufhzOzR2KSr8B9+yQOLvmfi Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 01 Sep 2022 20:05:53 -0700 IronPort-SDR: 2RZw9NvKwETdiuIpABB6cVwrHvXr1DlAy2RVHExxzYL7EDzt44aRPfMUgeKbvIu0NSgtSpN3nx 7QoeUol+V/2f4CsDGvSvyAfY2YWf6goMVvIWZbxC9paC8mas6T5n9DJCV0UqJ2C+/ji2eVHt3L mmYxJ3feWx8mH8cR03lfZ7gaInBNslpnV01e3Xugya9MZi1Zbcnh4nW/wDqr2XHtEl+lkw65Jq PyKbIcg2IWYSt4by6hg8C2M+KbBUyzaefbn6IJ2EjkcEWoh7iRv4rU6m9mfi1RZ7AQil7mOqEq mYc= WDCIronportException: Internal Received: from shindev.dhcp.fujisawa.hgst.com (HELO shindev.fujisawa.hgst.com) ([10.149.52.207]) by uls-op-cesaip02.wdc.com with ESMTP; 01 Sep 2022 20:45:24 -0700 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org Cc: Christoph Hellwig , Bart Van Assche , Sagi Grimberg , Chaitanya Kulkarni , Johannes Thumshirn , Shin'ichiro Kawasaki Subject: [PATCH blktests 5/5] Revert "nbd/rc: load nbd module explicitly" Date: Fri, 2 Sep 2022 12:45:16 +0900 Message-Id: <20220902034516.223173-6-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220902034516.223173-1-shinichiro.kawasaki@wdc.com> References: <20220902034516.223173-1-shinichiro.kawasaki@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org This reverts commit 78271b8bb8c939e1d0b9cfa3ea321a4ed06635bd. Once I thought explicit nbd module load in nbd/rc is required due to the commit 06a0ba866d90 ("common/rc: avoid module load in _have_driver()"). However, it was not a good solution and _have_driver() was modified again to load module. Hence, revert explicit nbd module load in nbd/rc. Signed-off-by: Shin'ichiro Kawasaki --- tests/nbd/rc | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/tests/nbd/rc b/tests/nbd/rc index 32eea45..9c1c15b 100644 --- a/tests/nbd/rc +++ b/tests/nbd/rc @@ -28,21 +28,17 @@ _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") - ret=1 + return 1 fi - modprobe -qr nbd - return $ret + return 0 } _wait_for_nbd_connect() { @@ -66,7 +62,6 @@ _wait_for_nbd_disconnect() { } _start_nbd_server() { - modprobe -q nbd truncate -s 10G "${TMPDIR}/export" cat > "${TMPDIR}/nbd.conf" << EOF [generic] @@ -78,20 +73,17 @@ 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" }