Received: by 2002:a05:6358:51dd:b0:131:369:b2a3 with SMTP id 29csp1011902rwl; Thu, 10 Aug 2023 05:18:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFfO63uDLZuDjpi4ELftnt++nVkiPqrwMqPLhuGFkwH1QX4fL8UanJNgaSVBLPRvxOsCUwc X-Received: by 2002:a17:906:cc5d:b0:99b:b398:53b6 with SMTP id mm29-20020a170906cc5d00b0099bb39853b6mr2395017ejb.34.1691669936663; Thu, 10 Aug 2023 05:18:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691669936; cv=none; d=google.com; s=arc-20160816; b=yev22fDhvk0elBeKT25LNurmRQu+sIsesFCyscty/63t2d7qH4gOpKLe3UecmLS+X6 ZZuS3V5BrWODl6CGnDy8WgEMD7FQtQNXA8BUuuR9ojivCETqGCeMrjFWSxjOEvHMsM4D /Bs++Ojg/GlwP8p5LGqYBXvZtjuDmrLBBS1jFXI+bkZOQKm+3h+20p8wSWDKg4avOVNc hmyMMxZFAknryORuG4ZZnIrGjGccyDFhamAQWu+PfUVRLcFNsU8hsCueBrF0hOyr+l51 GoyDUgyFfDKjP3em82z3mispvHU97cpg2EzmfPIxiI7URo2SaNvNwx2wt4fDBbEerMW3 csfw== 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=rbDYNVvlsfmPp7vHYHFE4FO2z3fiEokDrLA+6DaLKtM=; fh=bV6KfuSN3hKC74ZszsAG29NNR6004wMeMm9n9bF0ols=; b=XCfPljDrRD+pUFNf7oruU0Y7nx6kPZpNitOU5cXOmh+xj8CkPQiC8ZFEiDvdo+qqSM z+GHMcO9Udtuk7T0JSSzBLwVANUIB9/06vCcD0eCatq5u1AkhOPFuWMi8KeWkXClTovh PQIoFbcgzvr885aAf6HGl7HCHg7HO3CTFK8vcKzABK8ahj9SeMWAin/sqlU3Jou4itQC 6ILhACTg9Z/gsoKvNxV90dbfRCBGl7SMIYoUm8oxenHZtNe5trlU9/j8vUw8KhIKj87E 0jF3dZWp9QpDSByexDyY3H4QrsDzJXtzQ1aTeurtvQFxwj2YSxhX0F33pO/EM8L4aqXG qLqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=eD32g5e7; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g1-20020a1709063b0100b0099b41fa79f3si1291124ejf.331.2023.08.10.05.18.31; Thu, 10 Aug 2023 05:18:56 -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=eD32g5e7; 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 S231991AbjHJLNy (ORCPT + 99 others); Thu, 10 Aug 2023 07:13:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234957AbjHJLNg (ORCPT ); Thu, 10 Aug 2023 07:13:36 -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 F405626A5; Thu, 10 Aug 2023 04:13:28 -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 B3F971F86C; Thu, 10 Aug 2023 11:13:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1691666007; 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=rbDYNVvlsfmPp7vHYHFE4FO2z3fiEokDrLA+6DaLKtM=; b=eD32g5e7+DejaklZmtWfypKG0DHy38hs7P30hFzCJwNei9dwT1sccO8UFdoGbvyemj6Fz3 XbXjlxlEykaPx9zmHROUn8vi9yw9WsndbBFdk/GB0dRoc7H2fXO1klLAulJlc1tsa6zVRn LrugcSF2cfz4d7B0sVF+fXcg4AkhKh4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1691666007; 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=rbDYNVvlsfmPp7vHYHFE4FO2z3fiEokDrLA+6DaLKtM=; b=88V9IPQgLUdSdgN8/3+8sO6R3vYyROmPLAB+Q1exLZ8Y5c7w8hFGYX9Ip1YSJFQkKUB+pp Ce3ZLNk/XgFNCrAg== 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 A4913138E2; Thu, 10 Aug 2023 11:13:27 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id XOYAKFfG1GRKLwAAMHmgww (envelope-from ); Thu, 10 Aug 2023 11:13:27 +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 , Max Gurtovoy , Hannes Reinecke , Sagi Grimberg , James Smart , Bart Van Assche , Daniel Wagner Subject: [PATCH blktests v2 10/12] nvme/rc: Add helper for adding/removing to allow list Date: Thu, 10 Aug 2023 13:13:15 +0200 Message-ID: <20230810111317.25273-11-dwagner@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230810111317.25273-1-dwagner@suse.de> References: <20230810111317.25273-1-dwagner@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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 Add two helpers to add or remove the host from the allow list of the subsystem. Signed-off-by: Daniel Wagner --- tests/nvme/rc | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/tests/nvme/rc b/tests/nvme/rc index 7f5829a2e58d..706f95d74a4b 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -612,6 +612,23 @@ _create_nvmet_subsystem() { _create_nvmet_ns "${nvmet_subsystem}" "1" "${blkdev}" "${uuid}" } +_add_nvmet_allow_hosts() { + local nvmet_subsystem="$1" + local nvmet_hostnqn="$2" + local cfs_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}" + local host_path="${NVMET_CFS}/hosts/${nvmet_hostnqn}" + + ln -s "${host_path}" "${cfs_path}/allowed_hosts/${nvmet_hostnqn}" +} + +_remove_nvmet_allow_hosts() { + local nvmet_subsystem="$1" + local nvmet_hostnqn="$2" + local cfs_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}" + + rm "${cfs_path}/allowed_hosts/${nvmet_hostnqn}" +} + _create_nvmet_host() { local nvmet_subsystem="$1" local nvmet_hostnqn="$2" @@ -621,8 +638,7 @@ _create_nvmet_host() { local host_path="${NVMET_CFS}/hosts/${nvmet_hostnqn}" mkdir "${host_path}" - echo 0 > "${cfs_path}/attr_allow_any_host" - ln -s "${host_path}" "${cfs_path}/allowed_hosts/${nvmet_hostnqn}" + _add_nvmet_allow_hosts "${nvmet_subsystem}" "${nvmet_hostnqn}" if [[ "${nvmet_hostkey}" ]] ; then echo "${nvmet_hostkey}" > "${host_path}/dhchap_key" fi -- 2.41.0