From patchwork Mon Jul 3 09:16:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 115250 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp392445vqx; Mon, 3 Jul 2023 02:30:33 -0700 (PDT) X-Google-Smtp-Source: APBJJlGtnVTDhJonZseM5fvHfd1qazsh+eDzDELBMlnxuDlfltbArhbNnqJunte5mSi/rUMXM3u7 X-Received: by 2002:a17:902:ea0a:b0:1b8:35fa:cdcc with SMTP id s10-20020a170902ea0a00b001b835facdccmr10529987plg.5.1688376632945; Mon, 03 Jul 2023 02:30:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688376632; cv=none; d=google.com; s=arc-20160816; b=JX5UvqaJ1+fCLF7g5XAShssKCFPuK85XDcVrjF3kOhBXqTg1j1F0XrVRpw65hSIM7e LUzzTv+Pa9h07kXkkK+6XCw5lK49hzXDoNSJPjbJASzQbK46Ea4THF3K20zyBIalcng5 BBLe9W/KVjsQbaxeYhlas7sVwnPnWXaLRjO4mzmiJZMWZKaA+Mz6MIBPM1kBXCptgMFZ MQNC35zmkNRnCQLZaWGP55If6KT0mYAvJHeY+4ouX8AyvQ6eEEA7BGxGYonsyjU1qkVx cHt4c8TTj5JmmKRCZ69OD8VGhJalFHfU/Yam8znLt4w3ftrVoKkT5yOAxM5Wqs8wo+0z qJhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=y/IJwReM/uXABoejcS3ER1zTUO2yvPD9h8VV7ZhYdrs=; fh=8iYjC+LeMO0aYseTRhkFIffYD3bgeSdBPaCkXZFvDc0=; b=ByJd2wo5BI/1+XDi+t43hNyZTVakkkwST5NsVBCj7QfY5WBfHntmBKyx/EbAIGguE/ V0UZXES23/6kiGWivuwBRmZ7nV3AJojxBzPSp5hLga/JeI1Fv6+rGDfVY4zBxy/9OUbR uuyqxOUZUFnEL0i/Z1NnC3Vy5IwQbiZJiUeisTBGkaaS5aefGoaBKEr3mFLkvPqDWtp7 GJFfwSJGkn8Grk1S4lWYPzfqtOiEngHI1A+kW9UjkFFl0UZl9BYIjc2rtP3gtQTv4CtG Js/pxX8iWT3E07Goo/MuXgZz3TIickkU9o84Qck58fu2a1ghxxuM70dC6fll6TLsPlC9 Ojqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=AYN6Xg5y; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e18-20020a17090301d200b001b895a2c09esi2163931plh.381.2023.07.03.02.30.18; Mon, 03 Jul 2023 02:30:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=AYN6Xg5y; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230172AbjGCJRA (ORCPT + 99 others); Mon, 3 Jul 2023 05:17:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229709AbjGCJQ5 (ORCPT ); Mon, 3 Jul 2023 05:16:57 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82CC0191; Mon, 3 Jul 2023 02:16:56 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 379731FD72; Mon, 3 Jul 2023 09:16:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1688375815; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=y/IJwReM/uXABoejcS3ER1zTUO2yvPD9h8VV7ZhYdrs=; b=AYN6Xg5ypCLI8zd2oJ/WFghR//Umb+TVkxatu2rqY+riUBTN8uOgJYo72f5tilyspvJmhi XlMGYX8FZRRrASEccYMIfJ11tc/REdDaUt9x072X1oeQdw9uVbZCd2ilDOs392wjBlERwM f3/Y8M8nT8SWQ5CmfqV41Yi+Wv3ygxo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1688375815; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=y/IJwReM/uXABoejcS3ER1zTUO2yvPD9h8VV7ZhYdrs=; b=4IzB3ZJCS0YkTVGdVhkf1yUtpT3iH6mRH45T72e4QNjOLQDYo/Ik3Ll3A33Gnk6HaWYUjh QEvU4exRzv9RxuBQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 29C2313276; Mon, 3 Jul 2023 09:16:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 3M7bCQeSomSJDgAAMHmgww (envelope-from ); Mon, 03 Jul 2023 09:16:55 +0000 From: Daniel Wagner To: linux-nvme@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Chaitanya Kulkarni , Shin'ichiro Kawasaki , Sagi Grimberg , Hannes Reinecke , James Smart , Daniel Wagner Subject: [PATCH blktests v3 1/3] nvme/048: Check for queue count check directly Date: Mon, 3 Jul 2023 11:16:45 +0200 Message-ID: <20230703091647.800-2-dwagner@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230703091647.800-1-dwagner@suse.de> References: <20230703091647.800-1-dwagner@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770391216662425066?= X-GMAIL-MSGID: =?utf-8?q?1770391216662425066?= The test monitored the state changes live -> resetting -> connecting -> live, to figure out the queue count change was successful. The fc transport is reconnecting very fast and the state transitions are not observed by the current approach. So instead trying to monitor the state changes, let's just wait for the live state and the correct queue number. As queue count is depending on the number of online CPUs we explicitly use 1 and 2 for the max_queue count. This means the queue_count value needs to reach either 2 or 3 (admin queue included). Signed-off-by: Daniel Wagner --- tests/nvme/048 | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/tests/nvme/048 b/tests/nvme/048 index 81084f0440c2..bbfb9873b5e8 100755 --- a/tests/nvme/048 +++ b/tests/nvme/048 @@ -42,6 +42,24 @@ nvmf_wait_for_state() { return 0 } +nvmf_check_queue_count() { + local subsys_name="$1" + local queue_count="$2" + local nvmedev + local queue_count_file + + nvmedev=$(_find_nvme_dev "${subsys_name}") + queue_count_file=$(cat /sys/class/nvme-fabrics/ctl/"${nvmedev}"/queue_count) + + queue_count=$((queue_count + 1)) + if [[ "${queue_count}" -ne "${queue_count_file}" ]]; then + echo "expected queue count ${queue_count} not set" + return 1 + fi + + return 0 +} + set_nvmet_attr_qid_max() { local nvmet_subsystem="$1" local qid_max="$2" @@ -56,10 +74,8 @@ set_qid_max() { local qid_max="$3" set_nvmet_attr_qid_max "${subsys_name}" "${qid_max}" - - # Setting qid_max forces a disconnect and the reconntect attempt starts - nvmf_wait_for_state "${subsys_name}" "connecting" || return 1 nvmf_wait_for_state "${subsys_name}" "live" || return 1 + nvmf_check_queue_count "${subsys_name}" "${qid_max}" || return 1 return 0 } @@ -103,7 +119,7 @@ test() { echo FAIL else set_qid_max "${port}" "${subsys_name}" 1 || echo FAIL - set_qid_max "${port}" "${subsys_name}" 128 || echo FAIL + set_qid_max "${port}" "${subsys_name}" 2 || echo FAIL fi _nvme_disconnect_subsys "${subsys_name}" From patchwork Mon Jul 3 09:16:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 115246 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp388986vqx; Mon, 3 Jul 2023 02:21:34 -0700 (PDT) X-Google-Smtp-Source: APBJJlFSHVo47jNNCUxOYD2jE//ZxHjd6Tm4iAZ4xXFovKH6kU5fmmCD2Xy8vvd7DeYz3oqcNMWa X-Received: by 2002:a05:6a00:1f90:b0:675:8627:a291 with SMTP id bg16-20020a056a001f9000b006758627a291mr11145562pfb.3.1688376093866; Mon, 03 Jul 2023 02:21:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688376093; cv=none; d=google.com; s=arc-20160816; b=yvS118dPoGACSEyTMBe27768eXxtSvbV2oXkUyxODqZAJnXf+QyBt5USUWh91kYfw4 bPmP7QUdIyHj6xVHAooW4yKJfJQdbNYJpVqnTiv7AGieYpkEtFjgL9QC3+KPb9uEsMsL oSX5NqiLp7VUkVBNBIELRjx/TNBekIWpHWRnxjp8ORHc6d8RMQQPAwCTwd33M5J8gJx3 AzWdKLx2g80SdYyASCnGIurluS9mhu8hLu7jlPUbKdMrgUU+ek0EGnP5NdzOLkRr+r1v 3KqCUc+qNjMDBeLE9azP7MzyFWy4WLdPa65iKjo2LuY2lyOnVYWbNMo3fp+jXK897S09 feTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=I+8YBrUpE2qb6+lv32u7UaAshwQ/NzzYaAEBiSNLejw=; fh=8iYjC+LeMO0aYseTRhkFIffYD3bgeSdBPaCkXZFvDc0=; b=DydPzzqLNg6ThLFwG9gbMUuaPIz6ECBbMdc2NLnffUjVH5u3sT8EGydSGPqzGCY3Wi rnnqoi5NlQyesZYP6C70GBrGIZ/4frKTY8eyXyszXemVh1AnNAnEFXjdwWMxhlKO3LEA 6XZ9E/HMfHzMP7ZraDiq/J6a31Fy+OxiTWn/RobOlegBylbjrdUt6XIVfF5QYuGLYWWb rRzD2vvLSz53I+/W/+cTHjAOTVUQk618Htc6aJb+2aw8S7wTi0pSylzyBHuCVTngUVdC gKib+WRfmD/AJb9XabA9HbHnKpGTYrlfJVhCz6jxEp0eBMAauyN/4WzGYYKCDFEMbrp2 avEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=aJmI21Xo; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p23-20020a056a000a1700b0067b77e7f473si13578947pfh.232.2023.07.03.02.21.19; Mon, 03 Jul 2023 02:21:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=aJmI21Xo; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229709AbjGCJRC (ORCPT + 99 others); Mon, 3 Jul 2023 05:17:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229989AbjGCJQ6 (ORCPT ); Mon, 3 Jul 2023 05:16:58 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DF7612E; Mon, 3 Jul 2023 02:16:57 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id D6AB51FD75; Mon, 3 Jul 2023 09:16:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1688375815; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I+8YBrUpE2qb6+lv32u7UaAshwQ/NzzYaAEBiSNLejw=; b=aJmI21XoZATqMcxjej/15bKMZYrd+hA/+VsblssIvVvsNxnaHbEuh69tJAbB3DukWKT0tT HZ8blHsP1mKB8H06vSWCONF0DI+Wm5BTluLIB0ww4qUG/cvqOvbp2+aUTvOhWKu+U3RDFZ squn7W+cBtbkXqTAk4EqLQ3IN7GAjus= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1688375815; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I+8YBrUpE2qb6+lv32u7UaAshwQ/NzzYaAEBiSNLejw=; b=EFyh0LmGkHJ0/iuIO0GzOGCahFA9hXk1xaPJe68n7OeLUpLX8Cvr/9t0Iuarq2VSnhdoST 6urwYVCwcpLUeiBw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id C9CA613276; Mon, 3 Jul 2023 09:16:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id kRBAMQeSomSLDgAAMHmgww (envelope-from ); Mon, 03 Jul 2023 09:16:55 +0000 From: Daniel Wagner To: linux-nvme@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Chaitanya Kulkarni , Shin'ichiro Kawasaki , Sagi Grimberg , Hannes Reinecke , James Smart , Daniel Wagner Subject: [PATCH blktests v3 2/3] nvme/rc: Avoid triggering host nvme-cli autoconnect Date: Mon, 3 Jul 2023 11:16:46 +0200 Message-ID: <20230703091647.800-3-dwagner@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230703091647.800-1-dwagner@suse.de> References: <20230703091647.800-1-dwagner@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770390651313909118?= X-GMAIL-MSGID: =?utf-8?q?1770390651313909118?= When the host has enabled the udev/systemd autoconnect services for the fc transport it interacts with blktests and make tests break. nvme-cli learned to ignore connects attemps when using the --context command line option paired with a volatile configuration. Thus we can mark all the resources created by blktests and avoid any interaction with the systemd autoconnect scripts. Only enabled this for the fc transport. Signed-off-by: Daniel Wagner --- tests/nvme/rc | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/tests/nvme/rc b/tests/nvme/rc index 1c2c2fab62c1..9b5442b2c07b 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -176,6 +176,57 @@ _nvme_calc_rand_io_size() { echo "${io_size_kb}k" } +_have_nvme_cli_context() { + # ignore all non-fc transports for now + if [[ "${nvme_trtype}" != "fc" ]] || + ! nvme connect --help 2>&1 | grep -q -- '--context=' > /dev/null; then + return 1 + fi + return 0 +} + +_setup_nvme_cli() { + local local_wwnn="${1}" + local local_wwpn="${2}" + local remote_wwnn="${3}" + local remote_wwpn="${4}" + + if ! _have_nvme_cli_context; then + return + fi + + mkdir -p /run/nvme + cat >> /run/nvme/blktests.json <<-EOF + [ + { + "hostnqn": "${def_hostnqn}", + "hostid": "${def_hostid}", + "subsystems": [ + { + "application": "blktests", + "nqn": "blktests-subsystem-1", + "ports": [ + { + "transport": "fc", + "traddr": "nn-${remote_wwnn}:pn-${remote_wwpn}", + "host_traddr": "nn-${local_wwnn}:pn-${local_wwpn}" + } + ] + } + ] + } + ] + EOF +} + +_cleanup_nvme_cli() { + if ! _have_nvme_cli_context; then + return + fi + + rm -f /run/nvme/blktests.json +} + _nvme_fcloop_add_rport() { local local_wwnn="$1" local local_wwpn="$2" @@ -208,6 +259,9 @@ _setup_fcloop() { local remote_wwnn="${3:-$def_remote_wwnn}" local remote_wwpn="${4:-$def_remote_wwpn}" + _setup_nvme_cli "${local_wwnn}" "${local_wwpn}" \ + "${remote_wwnn}" "${remote_wwpn}" + _nvme_fcloop_add_tport "${remote_wwnn}" "${remote_wwpn}" _nvme_fcloop_add_lport "${local_wwnn}" "${local_wwpn}" _nvme_fcloop_add_rport "${local_wwnn}" "${local_wwpn}" \ @@ -250,6 +304,8 @@ _cleanup_fcloop() { _nvme_fcloop_del_lport "${local_wwnn}" "${local_wwpn}" _nvme_fcloop_del_rport "${local_wwnn}" "${local_wwpn}" \ "${remote_wwnn}" "${remote_wwpn}" + + _cleanup_nvme_cli } _cleanup_nvmet() { @@ -452,6 +508,9 @@ _nvme_connect_subsys() { subsysnqn="$2" ARGS=(-t "${trtype}" -n "${subsysnqn}") + if _have_nvme_cli_context; then + ARGS+=(--context="blktests") + fi if [[ "${trtype}" == "fc" ]] ; then ARGS+=(-a "${traddr}" -w "${host_traddr}") elif [[ "${trtype}" != "loop" ]]; then @@ -496,6 +555,9 @@ _nvme_discover() { ARGS=(-t "${trtype}") ARGS+=(--hostnqn="${def_hostnqn}") ARGS+=(--hostid="${def_hostid}") + if _have_nvme_cli_context; then + ARGS+=(--context="blktests") + fi if [[ "${trtype}" = "fc" ]]; then ARGS+=(-a "${traddr}" -w "${host_traddr}") elif [[ "${trtype}" != "loop" ]]; then From patchwork Mon Jul 3 09:16:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 115248 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp390964vqx; Mon, 3 Jul 2023 02:26:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5BJxac6j/yNkLOh3ump0SI+A5jhCLokOCAsFPS8gI0lafTquuHpJc5KObWCKCIJV8kCuTJ X-Received: by 2002:aca:bc83:0:b0:39e:ced8:8122 with SMTP id m125-20020acabc83000000b0039eced88122mr5748382oif.2.1688376407899; Mon, 03 Jul 2023 02:26:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688376407; cv=none; d=google.com; s=arc-20160816; b=HGt8ofbT8EJ4TTYB8s8ofmgTcnk7RD5JO7EfsY8luskGK7+o/eErx+QE1sWZ1vZ75h JmhyCXgc1Ak7GEdoO483I8UWMe7DN3z0QIToizfeNUFKOP9W1cR2ncB+rDLoQah6QsWh 1SwUAfiICat8c+WilB+vU+EovcU3wc3bTPkOvZLLxAAFgtj7jTYv0gKi2bwLjohL8P40 oZT8mXpQdalfe53o7YclTbLRZN+Ovg+wO+3YEpegeObLouC/e1IpibIflXIxycIb0Ksc COZfOJuMz1UifY2rYyz83UTlPcAyIxjC0cVIk1NROqiZmdk2/fKtgT3ZyueStNP/F98F g4yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=lwQ11ZCMfUbee76s3nRrSEKyCvgmp2Gel3xnxd/kPGE=; fh=8iYjC+LeMO0aYseTRhkFIffYD3bgeSdBPaCkXZFvDc0=; b=x/cGNRvMn8VtmARjU7NjtDjHygZZxD/84EgioTSgLO98I79oQ1QhLrfvTsvcyHDKUs wRWpQdhjZu1X1sv7aoyZsL9XggtveHhF8CXaHoCya0+JS8CK5gqYqf6gQETBfiVggcvU bNofT9znByakjtU/16L3Nnuls8QlL0DqQsv7H5Ml7JBI6pFtDT+8q//x4Z99AoBCyYrg AMm6M9B1kjO/9Zzp+2XyKf6c0kR9QjJmqe8HODOvmiuhviBAWdyUKRJNHsk7DmTzt/rc o9UaA6pQuDzrIBWaK///cSAtEQA13KxrgYlL7b1algRk0cjA9W+l4cUy9GyW3WiS1Pju eJzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=YbvAdaHs; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=Us5QDSYj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x7-20020a636307000000b0053f0cdab81esi18262019pgb.357.2023.07.03.02.26.34; Mon, 03 Jul 2023 02:26:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=YbvAdaHs; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=Us5QDSYj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231151AbjGCJRE (ORCPT + 99 others); Mon, 3 Jul 2023 05:17:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230192AbjGCJQ6 (ORCPT ); Mon, 3 Jul 2023 05:16:58 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA264191; Mon, 3 Jul 2023 02:16:57 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id A8DF11FD76; Mon, 3 Jul 2023 09:16:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1688375816; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lwQ11ZCMfUbee76s3nRrSEKyCvgmp2Gel3xnxd/kPGE=; b=YbvAdaHs2zQbMAkwg2aFEvUVKke4jx1axyARonpkBkIYq1qZ4JqWQCAMNQmw9l2qq8tATv DSKtOuZ15kVDXqJm4Yfhn6hwwK0ctT7Dd/3nyJsdhJYQq0tdhBQrKsocY5/pM+RUv31VFf bf+veDj8jnaslQsoENzloT3nPW06X0E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1688375816; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lwQ11ZCMfUbee76s3nRrSEKyCvgmp2Gel3xnxd/kPGE=; b=Us5QDSYjGJVTs39nuAyJdKx0428NkKHgJtr73DJDkahqT/agx5kzixI9qR/68S0tuftrZZ LnufDr/rT7avDVBw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 9482613276; Mon, 3 Jul 2023 09:16:56 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id zYFoJAiSomSNDgAAMHmgww (envelope-from ); Mon, 03 Jul 2023 09:16:56 +0000 From: Daniel Wagner To: linux-nvme@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Chaitanya Kulkarni , Shin'ichiro Kawasaki , Sagi Grimberg , Hannes Reinecke , James Smart , Daniel Wagner Subject: [PATCH blktests v3 3/3] nvme/{041,042,043,044,045,048}: Use default hostnqn and hostid Date: Mon, 3 Jul 2023 11:16:47 +0200 Message-ID: <20230703091647.800-4-dwagner@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230703091647.800-1-dwagner@suse.de> References: <20230703091647.800-1-dwagner@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770390980018579344?= X-GMAIL-MSGID: =?utf-8?q?1770390980018579344?= The host might have enabled the udev/systemd auto connect feature. This disturbs the blktests for the fc transport. nvme-cli is able to distinguish between the different invocations via the --context option. Instead creating random generated IDs or reuse the hostnqn, it's safer to always use the same hostnqn to reduce the risk that the matching logic doesn't work. Signed-off-by: Daniel Wagner --- tests/nvme/041 | 8 ++------ tests/nvme/042 | 8 ++------ tests/nvme/043 | 8 ++------ tests/nvme/044 | 8 ++------ tests/nvme/045 | 8 ++------ tests/nvme/048 | 8 ++------ tests/nvme/rc | 19 ++----------------- 7 files changed, 14 insertions(+), 53 deletions(-) diff --git a/tests/nvme/041 b/tests/nvme/041 index 308655dd6090..5b04b99b128e 100755 --- a/tests/nvme/041 +++ b/tests/nvme/041 @@ -30,12 +30,8 @@ test() { echo "Running ${TEST_NAME}" - hostid="$(uuidgen)" - if [ -z "$hostid" ] ; then - echo "uuidgen failed" - return 1 - fi - hostnqn="nqn.2014-08.org.nvmexpress:uuid:${hostid}" + hostid="${def_hostid}" + hostnqn="${def_hostnqn}" hostkey="$(nvme gen-dhchap-key -n ${subsys_name} 2> /dev/null)" if [ -z "$hostkey" ] ; then echo "nvme gen-dhchap-key failed" diff --git a/tests/nvme/042 b/tests/nvme/042 index fed2efead013..8df5ed37aacc 100755 --- a/tests/nvme/042 +++ b/tests/nvme/042 @@ -32,12 +32,8 @@ test() { echo "Running ${TEST_NAME}" - hostid="$(uuidgen)" - if [ -z "$hostid" ] ; then - echo "uuidgen failed" - return 1 - fi - hostnqn="nqn.2014-08.org.nvmexpress:uuid:${hostid}" + hostid="${def_hostid}" + hostnqn="${def_hostnqn}" _setup_nvmet diff --git a/tests/nvme/043 b/tests/nvme/043 index a030884aa4ed..b591e39d0706 100755 --- a/tests/nvme/043 +++ b/tests/nvme/043 @@ -33,12 +33,8 @@ test() { echo "Running ${TEST_NAME}" - hostid="$(uuidgen)" - if [ -z "$hostid" ] ; then - echo "uuidgen failed" - return 1 - fi - hostnqn="nqn.2014-08.org.nvmexpress:uuid:${hostid}" + hostid="${def_hostid}" + hostnqn="${def_hostnqn}" _setup_nvmet diff --git a/tests/nvme/044 b/tests/nvme/044 index 9928bcc55397..fca0897af27b 100755 --- a/tests/nvme/044 +++ b/tests/nvme/044 @@ -32,12 +32,8 @@ test() { echo "Running ${TEST_NAME}" - hostid="$(uuidgen)" - if [ -z "$hostid" ] ; then - echo "uuidgen failed" - return 1 - fi - hostnqn="nqn.2014-08.org.nvmexpress:uuid:${hostid}" + hostid="${def_hostid}" + hostnqn="${def_hostnqn}" hostkey="$(nvme gen-dhchap-key -n ${subsys_name} 2> /dev/null)" if [ -z "$hostkey" ] ; then diff --git a/tests/nvme/045 b/tests/nvme/045 index 26a55335a92c..eca629a18691 100755 --- a/tests/nvme/045 +++ b/tests/nvme/045 @@ -36,12 +36,8 @@ test() { echo "Running ${TEST_NAME}" - hostid="$(uuidgen)" - if [ -z "$hostid" ] ; then - echo "uuidgen failed" - return 1 - fi - hostnqn="nqn.2014-08.org.nvmexpress:uuid:${hostid}" + hostid="${def_hostid}" + hostnqn="${def_hostnqn}" hostkey="$(nvme gen-dhchap-key -n ${subsys_name} 2> /dev/null)" if [ -z "$hostkey" ] ; then diff --git a/tests/nvme/048 b/tests/nvme/048 index bbfb9873b5e8..a6ebb8927865 100755 --- a/tests/nvme/048 +++ b/tests/nvme/048 @@ -93,12 +93,8 @@ test() { _setup_nvmet - hostid="$(uuidgen)" - if [ -z "$hostid" ] ; then - echo "uuidgen failed" - return 1 - fi - hostnqn="nqn.2014-08.org.nvmexpress:uuid:${hostid}" + hostid="${def_hostid}" + hostnqn="${def_hostnqn}" truncate -s "${nvme_img_size}" "${file_path}" diff --git a/tests/nvme/rc b/tests/nvme/rc index 9b5442b2c07b..4f3a994d75ce 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -14,23 +14,8 @@ def_remote_wwnn="0x10001100aa000001" def_remote_wwpn="0x20001100aa000001" def_local_wwnn="0x10001100aa000002" def_local_wwpn="0x20001100aa000002" - -if [ -f "/etc/nvme/hostid" ]; then - def_hostid="$(cat /etc/nvme/hostid 2> /dev/null)" -else - def_hostid="$(uuidgen)" -fi -if [ -z "$def_hostid" ] ; then - def_hostid="0f01fb42-9f7f-4856-b0b3-51e60b8de349" -fi - -if [ -f "/etc/nvme/hostnqn" ]; then - def_hostnqn="$(cat /etc/nvme/hostnqn 2> /dev/null)" -fi -if [ -z "$def_hostnqn" ] ; then - def_hostnqn="nqn.2014-08.org.nvmexpress:uuid:${def_hostid}" -fi - +def_hostid="0f01fb42-9f7f-4856-b0b3-51e60b8de349" +def_hostnqn="nqn.2014-08.org.nvmexpress:uuid:${def_hostid}" nvme_trtype=${nvme_trtype:-"loop"} nvme_img_size=${nvme_img_size:-"1G"} nvme_num_iter=${nvme_num_iter:-"1000"}