From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B220E606A31A for ; Wed, 2 Dec 2026 03:47:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=WrgEIX5Y; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=yPrH0Ksp 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:References:In-Reply-To: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:List-Unsubscribe-Post: List-Owner; bh=nWd8XBHZ0+xNhngBVQK1o1FF0axatWbWiLVcl77Tw24=; b=WrgEIX5YiH5reI h7wuoPx2v272kLywMjBP184Q5eFrW1LARXLefRgKbBzRxo01poViuW+J7XfwW10FEUND+0PMWhyyy /543MYC3hwCZglpM7sAJ8tvfWsoygHw2Mq/FJqjFtTpR6cFKm0P9KESp3pSKMX5xUe1KMVEbN7RbS 6VbdgkFuQ/OFh4b4j6XjfkDAJdmtVdlWpXI4Ex7t29EHr2IlhRbB9OOLmzadw1JU0Ml4/L2pnd4Yo p5Tu06nMnDN7D9DpSg84E/Hiyl70CC8wiAZrrUv2s9mIhOje/WI9rB5dDV8qRueQzjZlzt26g1zCG ZYLEQ4QLJ7mV/9sJ9/JQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYbJQ-0000000A7lD-0Jc3; Wed, 02 Dec 2026 03:47:20 +0000 Received: from out30-98.freemail.mail.aliyun.com ([115.124.30.98]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYbJL-0000000A7j2-3lQA for linux-nvme@lists.infradead.org; Wed, 02 Dec 2026 03:47:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1796183233; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=nWd8XBHZ0+xNhngBVQK1o1FF0axatWbWiLVcl77Tw24=; b=yPrH0KspVpterWDnPGEpyco/Z7re5aLkbZuoQz/b39cB3k7OvcsN6nYOqvPqAqSEB1sVZ/fOId5oOP+kMbwSWgzW2m30AkibSr5mGKwEH0Tjym2KT82e4v7Es36NL+98RxchE4i0usoYHfzfs6n6Tfy6CfEo2Yq6ZwnTXlgKhVU= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R161e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam011083073210;MF=kanie@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0XG6JZ8i_1796183233; Received: from localhost(mailfrom:kanie@linux.alibaba.com fp:SMTPD_---0XG6JZ8i_1796183233 cluster:ay36) by smtp.aliyun-inc.com; Wed, 02 Dec 2026 11:47:13 +0800 From: Guixin Liu To: Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Nilay Shroff , Daniel Wagner , Hannes Reinecke Cc: linux-nvme@lists.infradead.org Subject: [PATCH 1/4] nvme: mask the status before checking for Host Identifier Inconsistent Date: Wed, 2 Dec 2026 11:47:04 +0800 Message-ID: <20261202034707.3844378-2-kanie@linux.alibaba.com> X-Mailer: git-send-email 2.43.7 In-Reply-To: <20261202034707.3844378-1-kanie@linux.alibaba.com> References: <20261202034707.3844378-1-kanie@linux.alibaba.com> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261201_194716_581225_7525296B X-CRM114-Status: GOOD ( 13.46 ) X-Spam-Score: -17.6 (-----------------) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-nvme" X-Spam-Status: No, score=-26.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 nvme_pr_resv_report() retries with the legacy data structure when the controller returns Host Identifier Inconsistent, but compares the raw status returned by nvme_execute_rq(). A controller that sets the DNR bit on that status never matches, so the fallback never happens and the reservation report fails against such controllers. Mask the status with NVME_SCT_SC_MASK, like nvme_status_to_pr_err() already does. Fixes: 5fd96a4e15de8 ("nvme: Add pr_ops read_keys support") Cc: stable@vger.kernel.org Signed-off-by: Guixin Liu --- Reproduced in a QEMU/KVM guest with nvmet-tcp loopback. A TEST-ONLY injection in the test target (not part of this patch) makes it reject Extended Data Structure reservation reports with Host Identifier Inconsistent | DNR, emulating a third-party controller, while accepting the legacy structure. Unpatched: nvme_pr_resv_report() compares the raw status, the DNR bit prevents the match, and no legacy retry is sent (one resv_report, eds=1; read-keys fails). Patched: the masked comparison matches, a second resv_report with eds=0 is sent and read-keys succeeds. Regression without the injection: EDS reservation report and read-keys succeed directly. drivers/nvme/host/pr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/pr.c b/drivers/nvme/host/pr.c index f5711702b16a..f0aebf890e07 100644 --- a/drivers/nvme/host/pr.c +++ b/drivers/nvme/host/pr.c @@ -219,7 +219,7 @@ static int nvme_pr_resv_report(struct block_device *bdev, void *data, retry: ret = __nvme_send_pr_command(bdev, cdw10, cdw11, nvme_cmd_resv_report, data, data_len); - if (ret == NVME_SC_HOST_ID_INCONSIST && + if ((ret & NVME_SCT_SC_MASK) == NVME_SC_HOST_ID_INCONSIST && cdw11 == NVME_EXTENDED_DATA_STRUCT) { cdw11 = 0; *eds = false; -- 2.43.7