Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp2022417lqa; Tue, 30 Apr 2024 06:27:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUQ3Fb7QNJ/zUNeNH3YikmJtP4uVYd0VvJ5LCLV2rSV3cMrrtuEIhfDGrolquO4Lcml2JSrnON68tWXTDZARh43t08bQG9L1HtkonXWTA== X-Google-Smtp-Source: AGHT+IH8FfRkfPRKeg3NMqcAPscijwFmM+bnYhrKlhegMDI5l4JBDB4EyMz9P9wf/9i2PFOX+e1M X-Received: by 2002:a50:9f6d:0:b0:572:a073:a39a with SMTP id b100-20020a509f6d000000b00572a073a39amr1044982edf.5.1714483672923; Tue, 30 Apr 2024 06:27:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714483672; cv=pass; d=google.com; s=arc-20160816; b=fzORcZoU5B4i2bWkbtJf/Aqo/yMwosg+oynnwl7bzQVDXz8m5vV0CVS0Be0n0EH0BL +c1uk5mE2Yx1/+F6flkFR6NCl3WzarAHeO2e9WXzjZq551oq3mcKvO8NIxizf2yAfHWu POvjAFkPHi2Oayfk56v55IDPQ0Mmzva23X3BK+Z+5+s98rEUY1+pNOkiOcRETZq8xjyh cis+803ej/J1nR71O3iOOnLIhz+/MebS5P86eBweKbywQeppnMQOg6TUu7G057Mqp7JO AGn3WTcpLjyxv74SSqFDzuV4EQgx/e5QNTwYBxT8FZs1zh2ek215HoRvqGEn7xKgbKUz M2Rg== 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=D5rUttiao1gfgHiNuULv3j0RH1kQuIhcL6vcbzvshaQ=; fh=DJuiNgwyR0bD8rPMSu/msvIvJ9b4/StdsZoGeLLj0J4=; b=nynpTg5G+W2bpbnH8Go0ZlNdB6G1VxdKqiUXUHzMq19Lm7fMVld62shaAWz/S8neg9 xiYLJUGCkzAJ667K1b19M8uo40d33Cv51n6Sjp8vpEZc4U23LdcbISE4GeBP0fj8Vv84 L6p7Sh1+0hDg91GJINXVUhbNXWUPQ7RtcHMY64aHY/2ID3+5I9J02sU33Jhvj3f4oKaU 78q8+ASj36mwUUjeoUtrAjz9htOyN96rQY/eXA3UrvzK9IaEUNnk4j33PRgo1U3bdE6E +jgvHn97Biq1wz/3UD+oKa1bsHaDXG42ByrLSwBJ6VCyt3+YkywcVJt97S5KWIbxr0Sl sDpw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=lYt3wGrT; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=lYt3wGrT; 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-163986-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163986-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id z13-20020a509e0d000000b005705bcdca17si15159810ede.444.2024.04.30.06.27.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 06:27:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-163986-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=lYt3wGrT; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=lYt3wGrT; 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-163986-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163986-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 45E811F25909 for ; Tue, 30 Apr 2024 13:20:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2265E173347; Tue, 30 Apr 2024 13:19:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="lYt3wGrT"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="YW3g6yvJ"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="lYt3wGrT"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="YW3g6yvJ" 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 ABB2E172BBF for ; Tue, 30 Apr 2024 13:19:41 +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=1714483183; cv=none; b=qZ45ce6rohJp6OQHGMF47VvgeauxaLCEimQw9YAGYacDRZMhMfsnEvRx/xAdR8OwKkDe0S4kuL173USfXEBQwJiOf5+lR9flSjhSfv+bfEvOUIdMaMnHAOQTFW7IMxROenL+LNc9iN5A2kiAoA3ptgA2ZkHenVttwHj7sWWJLT0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714483183; c=relaxed/simple; bh=C6Zn8VOHwXTgHLQaPeMnYxE2OulkefG+XkQTMoyYnpo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YmsTmPX+voc8u+oVTWik5EuZ5FVcLOtB8BPiazTH02BUz/1szX2Sna6exGIN72HSifcfcsASYRkKzZeqkLBDYOflrPNxuvmo9Eq2q3uNJdptIwA6l+1iUndiZc+5knaMN7G9xGUUAlHT+GVJTfZSKMdpQ/aW7oiQ1tWlshxqKlI= 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=lYt3wGrT; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=YW3g6yvJ; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=lYt3wGrT; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=YW3g6yvJ; 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 imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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 E68CC3406F; Tue, 30 Apr 2024 13:19:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1714483178; 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=D5rUttiao1gfgHiNuULv3j0RH1kQuIhcL6vcbzvshaQ=; b=lYt3wGrT8Fgv/Byww9jQhKoS1wZ2QJUuruYZsLj+dh+S3PET2l47ijL/TujEB2mwRAdhOi 6KFeAcGH6BYnqj9Xbi7HnBIAAdjTzgrjNrhK2HzBVDBqMBYCeZPlosAczMarh6RyZuJlP9 ALs81uj2apNenS9ourAbKt8W7o8HMVs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1714483178; 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=D5rUttiao1gfgHiNuULv3j0RH1kQuIhcL6vcbzvshaQ=; b=YW3g6yvJEPm5Y3U3HAheci9Sv1O8U4Lz5jPkw7DtF88iByTsVA+5WqVRpKrzORicSv7SkZ SbmbBefnwTLf4nDw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=lYt3wGrT; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=YW3g6yvJ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1714483178; 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=D5rUttiao1gfgHiNuULv3j0RH1kQuIhcL6vcbzvshaQ=; b=lYt3wGrT8Fgv/Byww9jQhKoS1wZ2QJUuruYZsLj+dh+S3PET2l47ijL/TujEB2mwRAdhOi 6KFeAcGH6BYnqj9Xbi7HnBIAAdjTzgrjNrhK2HzBVDBqMBYCeZPlosAczMarh6RyZuJlP9 ALs81uj2apNenS9ourAbKt8W7o8HMVs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1714483178; 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=D5rUttiao1gfgHiNuULv3j0RH1kQuIhcL6vcbzvshaQ=; b=YW3g6yvJEPm5Y3U3HAheci9Sv1O8U4Lz5jPkw7DtF88iByTsVA+5WqVRpKrzORicSv7SkZ SbmbBefnwTLf4nDw== Received: from imap1.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id D25D4133A7; Tue, 30 Apr 2024 13:19:38 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id GObnMervMGZ7MAAAD6G6ig (envelope-from ); Tue, 30 Apr 2024 13:19:38 +0000 From: Daniel Wagner To: Christoph Hellwig Cc: Keith Busch , Sagi Grimberg , James Smart , Hannes Reinecke , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, Daniel Wagner Subject: [PATCH v7 5/5] nvme: do not retry authentication failures Date: Tue, 30 Apr 2024 15:19:28 +0200 Message-ID: <20240430131928.29766-6-dwagner@suse.de> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240430131928.29766-1-dwagner@suse.de> References: <20240430131928.29766-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 X-Spam-Flag: NO X-Spam-Score: -3.01 X-Rspamd-Action: no action X-Rspamd-Queue-Id: E68CC3406F X-Spam-Level: X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from,2a07:de40:b281:106:10:150:64:167:received]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCPT_COUNT_SEVEN(0.00)[8]; RCVD_VIA_SMTP_AUTH(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:dkim,suse.de:email] When the key is invalid there is no point in retrying. Because the auth code returns kernel error codes only, we can't test on the DNR bit. Signed-off-by: Daniel Wagner --- drivers/nvme/host/auth.c | 6 +++--- drivers/nvme/host/fabrics.c | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/nvme/host/auth.c b/drivers/nvme/host/auth.c index a264b3ae078b..371e14f0a203 100644 --- a/drivers/nvme/host/auth.c +++ b/drivers/nvme/host/auth.c @@ -730,7 +730,7 @@ static void nvme_queue_auth_work(struct work_struct *work) NVME_AUTH_DHCHAP_MESSAGE_CHALLENGE); if (ret) { chap->status = ret; - chap->error = -ECONNREFUSED; + chap->error = -EKEYREJECTED; return; } @@ -797,7 +797,7 @@ static void nvme_queue_auth_work(struct work_struct *work) NVME_AUTH_DHCHAP_MESSAGE_SUCCESS1); if (ret) { chap->status = ret; - chap->error = -ECONNREFUSED; + chap->error = -EKEYREJECTED; return; } @@ -818,7 +818,7 @@ static void nvme_queue_auth_work(struct work_struct *work) ret = nvme_auth_process_dhchap_success1(ctrl, chap); if (ret) { /* Controller authentication failed */ - chap->error = -ECONNREFUSED; + chap->error = -EKEYREJECTED; goto fail2; } diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c index 36d3e2ff27f3..c6ad2148c2e0 100644 --- a/drivers/nvme/host/fabrics.c +++ b/drivers/nvme/host/fabrics.c @@ -567,12 +567,18 @@ EXPORT_SYMBOL_GPL(nvmf_connect_io_queue); * * - the DNR bit is set and the specification states no further connect * attempts with the same set of paramenters should be attempted. + * + * - when the authentication attempt fails, because the key was invalid. + * This error code is set on the host side. */ bool nvmf_should_reconnect(struct nvme_ctrl *ctrl, int status) { if (status > 0 && (status & NVME_SC_DNR)) return false; + if (status == -EKEYREJECTED) + return false; + if (ctrl->opts->max_reconnects == -1 || ctrl->nr_reconnects < ctrl->opts->max_reconnects) return true; -- 2.44.0