From patchwork Wed Jan 31 08:51:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 194604 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1758398dyb; Wed, 31 Jan 2024 01:01:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IGgvJqtBUwng2UD2wOOyJsqqxZ8WkgdyRzHuRfuImaaj2Rr8wPeeN4Z82roiUR4Jostsq1s X-Received: by 2002:a2e:3516:0:b0:2cf:3037:2a35 with SMTP id z22-20020a2e3516000000b002cf30372a35mr681817ljz.48.1706691717589; Wed, 31 Jan 2024 01:01:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706691717; cv=pass; d=google.com; s=arc-20160816; b=gnz4Y/3TRFNF6WCZ4sdtjToPfw0Aa+hGjejxY6+Kik2timaaBcwzUikKd9yi+/JScD UbQ731RXuFJYU/iBF31TxXure6giJ5codlwzwjXEIFksGwvcdwDkOGu29L1OV3LqYG9M F0/5zgmOQagvkXBj8NNqtiRg/+UdCKxjBPxQO4UkCWdHTNr/koLMwSlK4+VqF5nlr3uS YqioC7pvUYZ+Ys+LeXJrkH+jWAtyb4OLK62K1rhU9byZbPujqf+9Mfc/RAUlBJPCchGV lcxo5BkhJtsz6BUG+NS2r+Ahjn8sw5iPQcKAHq8m2MOA5lHoFtcugYg2I1th/A00K0Ne pIUg== 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=v3eB42jWbgjp3aLM+hqddiDWAfylZBSkEz+/P6B/bCA=; fh=KQcCotyDulYA7BnE7676DLc+Qa6VHWW2LvGz3h09CpM=; b=QMRQhkIrc08WOzj1IHBHEEQEJFyZVe99Q1lHaIFn9+LpVvJFzuvf/Odq8IQ4f24Ucy 2Eoi0Ck+sEo5h4xXR60aNV6+fX6dkqo2v3gWDLTUfeV6I5dUdmBv9HfLWdudk95PiaJ+ kJGxwG7KusEfMzC8/KlQAlzsttIY0qqkwNcxRiub/PJ4o6WkiEWwJiMVlScYjwu9DIb/ 5wa/2kHPgxJTei5auhzQ0gOHz94lonmhtlJH5f9RMKDe2fF/kpmUepp0g1e9ufLqwvHk hYHVbH+Qp80bw3+wsGKB3HNBym9TfLpOMU/lKLims/tStslVr7b2QLw4i0z9OFqFi9mx f2CA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=TU01xr0S; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=TU01xr0S; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; 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-46075-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46075-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de X-Forwarded-Encrypted: i=1; AJvYcCUDmz50ngZ6UwmCvQDEvQiKrgF2TaEEq0kXHem1cZU4hJR091oV2900tvLTFbCAltafLmTRCORIQNceywz8DIPvnmUXiw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id t13-20020a50ab4d000000b0055d095ffc36si5482309edc.156.2024.01.31.01.01.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 01:01:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46075-ouuuleilei=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=TU01xr0S; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=TU01xr0S; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; 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-46075-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46075-ouuuleilei=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 0CB641F2F236 for ; Wed, 31 Jan 2024 09:01:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 46B6282870; Wed, 31 Jan 2024 08:51:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="TU01xr0S"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="wAD2FZou"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="TU01xr0S"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="wAD2FZou" Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (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 3B1287A715 for ; Wed, 31 Jan 2024 08:51:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706691090; cv=none; b=MrpluA+qxMdIZpbRaUnbyXdBaUh0J6y2VakvfzX5oon8/7MJq8XbQlG+INxerQ27D6291Zl8x+7SJd5R5Kqzo5Mm31YsBi/NXUpAbwQqcqItw1cORzi702B0xiidocY7oN2Ok24DmmuIhv8sKuHrY3t7NRRUpfG523hGRoFatN0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706691090; c=relaxed/simple; bh=R+AipVdTTaELXWWbeaDSdfAnVcS7MO9phDeUl4CdJu0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UGYgiubMu7zom9f5E1v1n9dX9v7PUu5lyBUvH2RMH5x7WW3t206kHHoa7tA7tSJvkmoxV7lUaXX98rEpPcF+LRuX8SDeH7/1B+9oaAbWC8cMWVhTSpbellBJ9lZe0MHqnc9b9C85LBG4bEuA9jj5A3rrfJnrPoftC15AYiqU7uk= 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=TU01xr0S; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=wAD2FZou; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=TU01xr0S; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=wAD2FZou; arc=none smtp.client-ip=195.135.223.130 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-out1.suse.de (Postfix) with ESMTPS id 5FC0522195; Wed, 31 Jan 2024 08:51:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1706691086; 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=v3eB42jWbgjp3aLM+hqddiDWAfylZBSkEz+/P6B/bCA=; b=TU01xr0SmQvGHMHPEX7edpYR4lUK+Dhf/GB5BR+8Sj/8r9ozgHuNGNSN02+rRS1JfB9m37 ljMpmWhhzAZuVAEV8g6YBo5U35NH2cgL+bjH86Gm27gPRR/cJMGcMCi9yjzdP9zoaw+WXd alKr5hWFUtpbNAYiAZluRonPM4Z/0oQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1706691086; 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=v3eB42jWbgjp3aLM+hqddiDWAfylZBSkEz+/P6B/bCA=; b=wAD2FZou0247eB3mwCA5n9uPdQM8tsAEFX+OT11GoxaJtcPw2jgh+8Acys7vkidhNfsN+f ZpIbNTY2jRh6e3AQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1706691086; 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=v3eB42jWbgjp3aLM+hqddiDWAfylZBSkEz+/P6B/bCA=; b=TU01xr0SmQvGHMHPEX7edpYR4lUK+Dhf/GB5BR+8Sj/8r9ozgHuNGNSN02+rRS1JfB9m37 ljMpmWhhzAZuVAEV8g6YBo5U35NH2cgL+bjH86Gm27gPRR/cJMGcMCi9yjzdP9zoaw+WXd alKr5hWFUtpbNAYiAZluRonPM4Z/0oQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1706691086; 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=v3eB42jWbgjp3aLM+hqddiDWAfylZBSkEz+/P6B/bCA=; b=wAD2FZou0247eB3mwCA5n9uPdQM8tsAEFX+OT11GoxaJtcPw2jgh+8Acys7vkidhNfsN+f ZpIbNTY2jRh6e3AQ== 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 4D14E132FA; 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 SJNZEQ4KumWVHAAAn2gu4w (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 08/12] nvmet-fc: do not tack refs on tgtports from assoc Date: Wed, 31 Jan 2024 09:51:08 +0100 Message-ID: <20240131085112.21668-9-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 Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=TU01xr0S; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=wAD2FZou X-Spamd-Result: default: False [-1.80 / 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.99)[99.94%] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Queue-Id: 5FC0522195 X-Spam-Level: X-Spam-Score: -1.80 X-Spam-Flag: NO X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789595974409819267 X-GMAIL-MSGID: 1789595974409819267 The association life time is tied to the life time of the target port. That means we should not take extra a refcount when creating a association. Reviewed-by: Hannes Reinecke Reviewed-by: Christoph Hellwig Signed-off-by: Daniel Wagner --- drivers/nvme/target/fc.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c index 849d9b17c60a..fe3246024836 100644 --- a/drivers/nvme/target/fc.c +++ b/drivers/nvme/target/fc.c @@ -1107,12 +1107,9 @@ nvmet_fc_alloc_target_assoc(struct nvmet_fc_tgtport *tgtport, void *hosthandle) if (idx < 0) goto out_free_assoc; - if (!nvmet_fc_tgtport_get(tgtport)) - goto out_ida; - assoc->hostport = nvmet_fc_alloc_hostport(tgtport, hosthandle); if (IS_ERR(assoc->hostport)) - goto out_put; + goto out_ida; assoc->tgtport = tgtport; assoc->a_id = idx; @@ -1142,8 +1139,6 @@ nvmet_fc_alloc_target_assoc(struct nvmet_fc_tgtport *tgtport, void *hosthandle) return assoc; -out_put: - nvmet_fc_tgtport_put(tgtport); out_ida: ida_free(&tgtport->assoc_cnt, idx); out_free_assoc: @@ -1180,7 +1175,6 @@ nvmet_fc_target_assoc_free(struct kref *ref) dev_info(tgtport->dev, "{%d:%d} Association freed\n", tgtport->fc_target_port.port_num, assoc->a_id); - nvmet_fc_tgtport_put(tgtport); kfree(assoc); }