Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1531307rdb; Wed, 31 Jan 2024 01:08:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IHhjcr1vjC/aSLhzf8LawHH5Jm7NpwFnmvwljV1lTwjJc6bZgU98KvscCiFRy+rZ2FAcRcR X-Received: by 2002:a05:6402:b7a:b0:55e:ece2:1213 with SMTP id cb26-20020a0564020b7a00b0055eece21213mr648712edb.13.1706692109746; Wed, 31 Jan 2024 01:08:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706692109; cv=pass; d=google.com; s=arc-20160816; b=iYqFYGA5lYrUS9gK/LXePiHalNRwJigXfsBjQGI8Zgbu/MAgq8J/w2yZxsnph6Y1YP eKScAHeY6Dj38r/HGvBWIbMY72/ZejX3XFGYLr/+W0xprDSLJ/iXyKFbIbBpn0Zbu3BC sXAuvE7AU/gTseB6q30jPlXYiEpF6emGMsO1WLaHwB+9pknkMhrTwT06Q6j8MxzDl7K0 0xxLBgfZafyW5601tGREU8tYvfu9ywBTQ2UCxrHkVJqUKNYvt1z+P+2BXRsc8PwrDsyl yf/ktBIxQGQc2nHloILANvXMx0hGrncv69trT5UDfm9C0eNRZ6Tp79i47G34GHW6mBio xfPA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:dkim-signature :dkim-signature:dkim-signature; bh=NwD69Rb4Ovy/rg6BuDZUolwj46uS8Nqdj2ffUDESYmI=; fh=1RCdX6yYnNGbgyO6kphXeIiYS/f3E9qagn+QkO3AZNQ=; b=rj4Z68oi8/M+043j9c6ubMtTPuwjYgEtqEQRAI8sgLUL4hLLc5BOWkFrdU6IkjpDGx aOJ1eWdIPhD2Zjwy1+1YwmG3WCr0sMw4w3mZ5ISFsSgladPOuCh8M8bKvX3oxm2gkk5T vrCsxcjbogrlRsS5jQWSgiPmvb1nOHnGoNJ47PuEQwFz0J7B+fbW/LyeEeNR7hOv4f7j DaoTRLXVsGbxugyHcR/7ynIvkrUag54hdc2koW2HZNQX0i3YpCJVSaq9A5jmVfdGM/Yh pf3G90ysaX7e45ug5u5NOxe2XU7XmKB7xPWKKEQnA/OfqS8Nk64zzzitnBZVljmn7Ypr dPhw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="qBJYU/tI"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="qBJYU/tI"; dkim=neutral (no key) header.i=@suse.de header.b=uI5ABNFF; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-46076-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46076-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de X-Forwarded-Encrypted: i=1; AJvYcCX6/EukyxQFOBEO9t8w4bDFkTXEO+eB7bUjbGt0P0kc/7eVhdHkHW+xWbb70ffixvcs0ZUERFKrir+7jOiXAgJZjTSxvTY696brmMLtpg== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id p10-20020a056402044a00b00557a9f389aasi5442190edw.559.2024.01.31.01.08.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 01:08:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46076-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="qBJYU/tI"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="qBJYU/tI"; dkim=neutral (no key) header.i=@suse.de header.b=uI5ABNFF; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-46076-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46076-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 42F5F1F2EA72 for ; Wed, 31 Jan 2024 09:00:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C55877F477; Wed, 31 Jan 2024 08:51:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="qBJYU/tI"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="uI5ABNFF"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="qBJYU/tI"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="uI5ABNFF" Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A80D879DA4 for ; Wed, 31 Jan 2024 08:51:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706691090; cv=none; b=bMxJ23n4IucNm3hVlmzj/t2C6DMXKKaPRxxBK/4kWCSgT4YGCiOe93XXKuzZZADPGaP0U2VYyLw7TO4DwQA2YGReOo7ldsnxRLpofAZOx2Q73HINZutXk6aH7An59T6KqxhQJRkQ2YBj/g9g1Ln23AKNExQXswKlvK8VeSvdqZ4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706691090; c=relaxed/simple; bh=coe/c0JKdSouUfLh6dzFg4/7jsYn8i3YdtJ4V6+eiMs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jA5KkJ6sbwuXOp6Oo1qgaaVW/EaRhEFXhSWV+eAicyTjqEymltg3D77YWWCs63zRFPeEOUK1w3TM+YWiWXBL1gp13vHWqMF8PF4XeOW3ANcHEUOTOoSgW/iI3lB3kcO5t5ykCQm5quzK94kHF0IqT6g2/VC9Tv/xUq82Fh0gwf0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=qBJYU/tI; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=uI5ABNFF; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=qBJYU/tI; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=uI5ABNFF; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:98]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 03F221FD0A; Wed, 31 Jan 2024 08:51:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1706691087; 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=NwD69Rb4Ovy/rg6BuDZUolwj46uS8Nqdj2ffUDESYmI=; b=qBJYU/tI6j44El8T38dpMPmQFBHQ7EV+uE73VMBvrYlvgInoeeMOhk/IPLrLu8AqVA6a4n gb1e50BqDnsl5RSbhSOGukyuA4Fl1eW5Rhp4yxiO1DUJLmwKLKvlKzKxU/rEDiAjPq2GsW s78FDYPTS8e+pHQuOTiAEfqfJVt6/+g= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1706691087; 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=NwD69Rb4Ovy/rg6BuDZUolwj46uS8Nqdj2ffUDESYmI=; b=uI5ABNFFvxjGkzFXZmBy6BLnb78DDdvMbwLRHoomuwcUdrhh++C8RkPRJj7TDKbtbkacjW MldXcc7gZBA39IAg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1706691087; 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=NwD69Rb4Ovy/rg6BuDZUolwj46uS8Nqdj2ffUDESYmI=; b=qBJYU/tI6j44El8T38dpMPmQFBHQ7EV+uE73VMBvrYlvgInoeeMOhk/IPLrLu8AqVA6a4n gb1e50BqDnsl5RSbhSOGukyuA4Fl1eW5Rhp4yxiO1DUJLmwKLKvlKzKxU/rEDiAjPq2GsW s78FDYPTS8e+pHQuOTiAEfqfJVt6/+g= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1706691087; 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=NwD69Rb4Ovy/rg6BuDZUolwj46uS8Nqdj2ffUDESYmI=; b=uI5ABNFFvxjGkzFXZmBy6BLnb78DDdvMbwLRHoomuwcUdrhh++C8RkPRJj7TDKbtbkacjW MldXcc7gZBA39IAg== Received: from imap2.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id E54E5132FA; Wed, 31 Jan 2024 08:51:26 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id 9PmSNg4KumWYHAAAn2gu4w (envelope-from ); Wed, 31 Jan 2024 08:51:26 +0000 From: Daniel Wagner To: James Smart Cc: Keith Busch , Christoph Hellwig , Hannes Reinecke , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, Daniel Wagner Subject: [PATCH v5 09/12] nvmet-fc: abort command when there is no binding Date: Wed, 31 Jan 2024 09:51:09 +0100 Message-ID: <20240131085112.21668-10-dwagner@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240131085112.21668-1-dwagner@suse.de> References: <20240131085112.21668-1-dwagner@suse.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b="qBJYU/tI"; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=uI5ABNFF X-Spamd-Result: default: False [-1.52 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_MISSING_CHARSET(2.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DWL_DNSWL_HI(-3.50)[suse.de:dkim]; BROKEN_CONTENT_TYPE(1.50)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.de:+]; MX_GOOD(-0.01)[]; RCPT_COUNT_SEVEN(0.00)[7]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-2.71)[98.74%] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Queue-Id: 03F221FD0A X-Spam-Level: X-Spam-Score: -1.52 X-Spam-Flag: NO When the target port has not active port binding, there is no point in trying to process the command as it has to fail anyway. Instead adding checks to all commands abort the command early. Reviewed-by: Hannes Reinecke Reviewed-by: Christoph Hellwig Signed-off-by: Daniel Wagner --- drivers/nvme/target/fc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c index fe3246024836..c80b8a066fd1 100644 --- a/drivers/nvme/target/fc.c +++ b/drivers/nvme/target/fc.c @@ -1099,6 +1099,9 @@ nvmet_fc_alloc_target_assoc(struct nvmet_fc_tgtport *tgtport, void *hosthandle) int idx; bool needrandom = true; + if (!tgtport->pe) + return NULL; + assoc = kzalloc(sizeof(*assoc), GFP_KERNEL); if (!assoc) return NULL; @@ -2514,8 +2517,9 @@ nvmet_fc_handle_fcp_rqst(struct nvmet_fc_tgtport *tgtport, fod->req.cmd = &fod->cmdiubuf.sqe; fod->req.cqe = &fod->rspiubuf.cqe; - if (tgtport->pe) - fod->req.port = tgtport->pe->port; + if (!tgtport->pe) + goto transport_error; + fod->req.port = tgtport->pe->port; /* clear any response payload */ memset(&fod->rspiubuf, 0, sizeof(fod->rspiubuf)); -- 2.43.0