From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1C023C48260 for ; Fri, 16 Feb 2024 08:45:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=403rjhUhkgmIPcGE1ndabC2ltuIaZcgjrlVJxlVXY2M=; b=q94Z5948mbeIyEZmk/ExoTMcgA Jk1HBJNJ7PRXDe7PuZ5kXpbCeEeyKVZbCovNSrEaDluz/WNQzIawLS8rMMTZcVpBFMrebZwKK0inv xCcx1UgtnS2KoLvmKuilVoxHJu/L3qFjgo48Q8XxdxzMuaBXsccVP5yp7roixEefQuIYtEw5nX/TD no5wThQkeqvNmU9z/IS/hGgfPiR2N1xxrb6SUHwb0YaMTLaV1p23Lm+qLRqT8q/TmQ080s/hiBVTO Du6pDwsBCfUjQOFrmGSJYHD/83kIHYI2DyNJ1aixv7LMC2m0u4XkmpoAKQ42A06XsMzTe4r0sBMnp zlAX+Bew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1ratqu-00000001ZRt-16py; Fri, 16 Feb 2024 08:45:48 +0000 Received: from smtp-out1.suse.de ([195.135.223.130]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1ratqq-00000001ZOD-1Yxz for linux-nvme@lists.infradead.org; Fri, 16 Feb 2024 08:45:47 +0000 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 C72D621FBE; Fri, 16 Feb 2024 08:45:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1708073138; 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; bh=403rjhUhkgmIPcGE1ndabC2ltuIaZcgjrlVJxlVXY2M=; b=pnZF/Ej1irKm/Pjj1LY3waGtoPw9vua/7wmYPSY1EAB/35/fwhCTXdX0w5u3bX8v0WV7aL 1YBXxEmVxkgLSRuDBAHJaLxgSiLZLaJnVkpGu5dQhtjyf6p1qNDPILhjQSheS5NKrzzx7l dDyRGbowj2IC4o4HToknnJTHAE3gvN4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1708073138; 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; bh=403rjhUhkgmIPcGE1ndabC2ltuIaZcgjrlVJxlVXY2M=; b=NhqBmSZ55PzV4PerbMnRZut8OC5BKdjB4w4Kow6P54+lTElllCb3qrCJWuhF8ImXwKs+QY 3KagPhxIwNWjOgDg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1708073138; 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; bh=403rjhUhkgmIPcGE1ndabC2ltuIaZcgjrlVJxlVXY2M=; b=pnZF/Ej1irKm/Pjj1LY3waGtoPw9vua/7wmYPSY1EAB/35/fwhCTXdX0w5u3bX8v0WV7aL 1YBXxEmVxkgLSRuDBAHJaLxgSiLZLaJnVkpGu5dQhtjyf6p1qNDPILhjQSheS5NKrzzx7l dDyRGbowj2IC4o4HToknnJTHAE3gvN4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1708073138; 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; bh=403rjhUhkgmIPcGE1ndabC2ltuIaZcgjrlVJxlVXY2M=; b=NhqBmSZ55PzV4PerbMnRZut8OC5BKdjB4w4Kow6P54+lTElllCb3qrCJWuhF8ImXwKs+QY 3KagPhxIwNWjOgDg== 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 B326013343; Fri, 16 Feb 2024 08:45:38 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id 8htVKrIgz2WVcwAAn2gu4w (envelope-from ); Fri, 16 Feb 2024 08:45:38 +0000 From: Daniel Wagner To: James Smart Cc: Keith Busch , Christoph Hellwig , Sagi Grimberg , Hannes Reinecke , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, Daniel Wagner Subject: [PATCH v0 0/6] nvme-fc: fix blktests nvme/041 Date: Fri, 16 Feb 2024 09:45:20 +0100 Message-ID: <20240216084526.14133-1-dwagner@suse.de> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b="pnZF/Ej1"; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=NhqBmSZ5 X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-1.51 / 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]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:98:from]; 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]; BROKEN_CONTENT_TYPE(1.50)[]; DWL_DNSWL_MED(-2.00)[suse.de:dkim]; NEURAL_HAM_LONG(-1.00)[-1.000]; 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)[8]; MID_CONTAINS_FROM(1.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; NEURAL_HAM_SHORT(-0.20)[-1.000]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] X-Rspamd-Queue-Id: C72D621FBE X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240216_004544_605500_E77B67AF X-CRM114-Status: GOOD ( 15.97 ) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org After the target side is working with blktests and blktest is also able to deal with the FC transport, it's time to address the fallouts on the host side. As first step, let's fix the failing nvme/041 tests. As we arleady discussed, the main issue here is that FC transport is deferring the connect attempt to a workqueue. The other fabric transport don't do this. And all blktests expect that the 'nvme connect' call is synchronous. Initially, I just added the completion and waited on connect to succeed or fail. But this triggered a lot of UAFs. After banging my head on this problem for a while I decided to replace the complete ref counting strategy. With this new approach all execept nvme/048 are passing and no UAFs or other troubles observed. I also tested with real hardware (lpfc, qla2xxx), though I don't have a way to trigger all sorts of transport errors which would be interesting to see if my patches are breaking anything. I think there is still on problem left in the module exit code path. The cleanup function iterates over the ctrl list storred in the rport object. The delete code path is not atomic and removes the controller from the list somewhere in the delete path. Thus this races with the module unload, IMO. we could just maintain a list of controllers which is protected a lock as we have in tcp/rdma. Daniel Wagner (6): nvme-fabrics: introduce connect_sync option nvme-fc: rename free_ctrl callback to match name pattern nvme-fc: do not retry when auth fails or connection is refused nvme-fabrics: introduce ref counting for nvmf_ctrl_options nvme-fc: redesign locking and refcounting nvme-fc: wait for connect attempt to finish drivers/nvme/host/fabrics.c | 28 +++++- drivers/nvme/host/fabrics.h | 9 +- drivers/nvme/host/fc.c | 180 ++++++++++++++++-------------------- drivers/nvme/host/rdma.c | 18 +++- drivers/nvme/host/tcp.c | 21 +++-- drivers/nvme/target/loop.c | 19 ++-- 6 files changed, 150 insertions(+), 125 deletions(-) -- 2.43.0