From patchwork Tue Jan 30 09:49:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 193935 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1107396dyb; Tue, 30 Jan 2024 01:54:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IECgV0wnAZa5Fe9WJoKFDKhGaJhxrvhTnUDe/fHjxhrEXc6dPLH6yCEeWhCOLyhI2h/F1/W X-Received: by 2002:a05:620a:1264:b0:783:fd95:d37b with SMTP id b4-20020a05620a126400b00783fd95d37bmr3697959qkl.16.1706608483254; Tue, 30 Jan 2024 01:54:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706608483; cv=pass; d=google.com; s=arc-20160816; b=RibkdcA3q2CWfaT/jdY7NVCx3ndnowSFIU9ITzyYrnAvqwNiekGWvqWu5rjk20ll3E PkPZ/b/pPWa99ia13Uv5hOykkCK+tSvUP2mZVLFAry9UdOUo40ST+3JkUzN2ifUNihIl 2m3Z9WgHt00ijLJcqsUaOxmZo4Rka0NxBkDuSPpImBZhHyly6TlUWCSDh11MiC6VTn8X PrB6UCseF2UKUa1mEGNwJyyJg5Oso33SqQJ5/ImcnmN2wre+jSv7KD858otpVBZSFZPI vmwUdH6w7Z4tpdiW449WCz6nlRPkHFUA73pmbnoue+Wmfp2ueNz9JvkfMzOlGKyjEOpr Bgsw== 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=ArsBVr4X2W3cBS3yrpUYNRtEX4mV/KoxFRj8N6+pwMQ=; fh=n5BdL0bf9gAg+lJbD9hdO95/5FlrOLRCMPX4XUPPjVI=; b=zJO1Nt/JZmsWxsBgz5yPnZniC1Q4dFvpPvJac9+9gkkVZ+LF6taoIyjZwX/jyCu8EU h938VH+KrxH28zTXys4VSkbjPQDSzoAkrm1hYzNnv4gIoBRZR/NgI64md3goCjqIU78N 6PusPdXorn0nQpQuQeq0Vvn6PwfoWIXh8VPnPM35ZUFFYSb3s8eFlP9dm2P490Gjb+7T UJa4OP3pgi/81TIMawd7Z3hblw8Arkic0pky5+HhbHYtpUfJrN+50RexnKhZlsf0pLwS D6NRQJOdSp41sZnY3tpmPehd8grm83Fp65n4ocRbAlohE/MIK4II21zAmm8HGiqI63pb rTPA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=kk54gtem; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=kk54gtem; 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-44311-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44311-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id a5-20020a05620a16c500b00783f7041596si5138205qkn.309.2024.01.30.01.54.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 01:54:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44311-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=kk54gtem; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=kk54gtem; 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-44311-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44311-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 02AFE1C211E7 for ; Tue, 30 Jan 2024 09:54:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 09F0C679FF; Tue, 30 Jan 2024 09:50:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="kk54gtem"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="/FPxM7rK"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="kk54gtem"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="/FPxM7rK" 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 C540C6775F for ; Tue, 30 Jan 2024 09:49:54 +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=1706608196; cv=none; b=SWgR3Rc85f8gJgQM2iSlJv0K/P0c8xYayrZRD4AC7/uLAUzsHh1hL+OdhMeSE/O2MbjJTzRFuk9XLsu61p2hzKpTh8MM4urDRUU0EhNYMJXJjavNuZa7KYrqbn1qDhY+vkcKu8BZvKsF/TiXTf7rIxNgvidkZQMpj9B9lC1UaUM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706608196; c=relaxed/simple; bh=mIZwEJGfu9NaCJqxMhgK8ij1RIeQD9q3/C0X3SvSVUg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WSSVlSB6JqT1ZBXgB5EuGvu8eK0710OZAfip5uu7zOLq/BF/Ce2i7DmcRxiXpLrGnWz+b9FV7kj8tdcYT6rPNd/b/V7XVwCY5K9MQ/Q2dOD40K5cekgfmoHeiZaaOG76P4+NBmDX7AEa5oOVneLR+3Q6Pe4yskm5Ewad1hBJnE8= 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=kk54gtem; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=/FPxM7rK; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=kk54gtem; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=/FPxM7rK; 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 [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 068E31F83F; Tue, 30 Jan 2024 09:49:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1706608193; 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=ArsBVr4X2W3cBS3yrpUYNRtEX4mV/KoxFRj8N6+pwMQ=; b=kk54gtemSwGYIp4SkoPy6OEMRUHyd3dEDz3e+ZXMs8X60BtGZFqNnx7WiVmqxzJKCDjQIr NN7IiMX/3SUnCvwCEOuVi5mcq0y6O2FJFV99/xzIKJDDFayU7lIs2P4uKJiYMEirWvwd9E +o+GM9hgW4aT/71vMSfaYd9rLS9+onw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1706608193; 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=ArsBVr4X2W3cBS3yrpUYNRtEX4mV/KoxFRj8N6+pwMQ=; b=/FPxM7rKSN973FmMkaA5HCNavTR8MiRdIzDhIqBhAVpM/v27F0ETJ9RmjWD6kuU+fW71H2 0N5kEjkarjYV+TBQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1706608193; 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=ArsBVr4X2W3cBS3yrpUYNRtEX4mV/KoxFRj8N6+pwMQ=; b=kk54gtemSwGYIp4SkoPy6OEMRUHyd3dEDz3e+ZXMs8X60BtGZFqNnx7WiVmqxzJKCDjQIr NN7IiMX/3SUnCvwCEOuVi5mcq0y6O2FJFV99/xzIKJDDFayU7lIs2P4uKJiYMEirWvwd9E +o+GM9hgW4aT/71vMSfaYd9rLS9+onw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1706608193; 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=ArsBVr4X2W3cBS3yrpUYNRtEX4mV/KoxFRj8N6+pwMQ=; b=/FPxM7rKSN973FmMkaA5HCNavTR8MiRdIzDhIqBhAVpM/v27F0ETJ9RmjWD6kuU+fW71H2 0N5kEjkarjYV+TBQ== 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 E84B913462; Tue, 30 Jan 2024 09:49:52 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id 08dCN0DGuGWXbwAAn2gu4w (envelope-from ); Tue, 30 Jan 2024 09:49:52 +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 v4 08/12] nvmet-fc: do not tack refs on tgtports from assoc Date: Tue, 30 Jan 2024 10:49:34 +0100 Message-ID: <20240130094938.1575-9-dwagner@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240130094938.1575-1-dwagner@suse.de> References: <20240130094938.1575-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-out2.suse.de; none X-Spamd-Result: default: False [0.88 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; 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]; REPLY(-4.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; R_RATELIMIT(0.00)[to_ip_from(RL7u6ok1g4a6hhe6aduz96x8er)]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_SEVEN(0.00)[7]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[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(-0.02)[54.83%] X-Spam-Level: X-Spam-Flag: NO X-Spam-Score: 0.88 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789508697011018306 X-GMAIL-MSGID: 1789508697011018306 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 Signed-off-by: Daniel Wagner Reviewed-by: Christoph Hellwig --- 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); }