From nobody Tue Nov 05 01:29:07 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Xj9jJ2KYDz5cpYm; Tue, 05 Nov 2024 01:29:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Xj9jH71Ppz4rsN; Tue, 5 Nov 2024 01:29:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730770148; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WXeSAjbXxHyv7o8jR2ZmcQZwcTGNCPozKLWcavhLbkQ=; b=fVda0uqxL9GQNRPemERhzlYbX1vPXvAWabb7KUBXcCP/bbUUVxhbQ5e+y3AbgWTGyDvok9 SoYkJ6X01ap4AHS72wGTy9hpDvjmGyVSjdmmrnKYFXiCOsdkJWma7CfpuOwqSOPM+1zKLD mTk+tXsoqCeVc28cSHwO56JfhiMJfzABvj8Pu1hytNxG+Nek6tVTtYp270mkuBhF4Xz3ok znVLtCJcIJppCtP5YmCYrskXAoM9QRIyzB/uOgjH921kF1pelE1gIXfkKSleZ2/MzB+wib GjvDSikyVvbr5wpQNEn7qPjNhvNjit9w2OwRkSymcZQVboXmlTgRxnoap9yMwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730770148; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WXeSAjbXxHyv7o8jR2ZmcQZwcTGNCPozKLWcavhLbkQ=; b=UQ01ajgCrXFbtSeKqRLQOvCEAqzPP/WpNdvCg43bGVKAmpZxtXEWI0q1J3FRRTguJzgPPv HelvYroPULnVcNRuy85wSxgp8J7uQmluS2T5HCZWcfFNPh9qAotviwintUiwcC9KGPNfH9 cxZjTLxq4LK8HRiCA+a3DPlO9ioNKKQCgh23+SmWKJYGzwIxtqVxYEFxEavOyma7w0IbuK HAILOPZo5J8xnsQQ6uV13odSab5aPb8ioEm+Ulq84+AfsF/iUD1VDGnQPtiOqzDnplDK/C tpiVccCeur6v+Fx+7USWWi7r0ukeOENVGMlodAEtnhEBy/mAzVhLfmTl+EuxLQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730770148; a=rsa-sha256; cv=none; b=YgoNHXKdNuBr+ANaluOO+HGVR+0m7oyYt3hg7czkNj15N2ljZmZJqnuWW71MvZUhKK52c1 Q6jfbBYQejG4ZyLfxyfy0A/0y6Yy+wzG3Zq2VdqQFQUjlAqwqMytvuX3mJCCZRszF+X/n6 u8QMWSJoy4X7fuYzk9P6HdsHXmLRuBjWA3blzVY4clX8g0LNaGFoNf8ZHJEk8ZcRqbOFrz bCI5+dlbvSscl7O961mlR41ayZKkO1aurDMUV14CBePmEqcCp5fD7bIKyNJ9xytfaNgTx2 iaoKKl9AsL/N01g4F7PUa6ej4kj3jZ8/uuE5ihBZ9eBkg0W6n4p8yYQ0cHeT5A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Xj9jH4yQmzxJg; Tue, 5 Nov 2024 01:29:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4A51T7ib031928; Tue, 5 Nov 2024 01:29:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4A51T7r3031925; Tue, 5 Nov 2024 01:29:07 GMT (envelope-from git) Date: Tue, 5 Nov 2024 01:29:07 GMT Message-Id: <202411050129.4A51T7r3031925@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 8922c5b8211e - main - nvmf: Fix an off by one error when scanning active namespace IDs List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8922c5b8211e5b2f64b10791b51d08d5b7945f56 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=8922c5b8211e5b2f64b10791b51d08d5b7945f56 commit 8922c5b8211e5b2f64b10791b51d08d5b7945f56 Author: John Baldwin AuthorDate: 2024-11-05 01:27:14 +0000 Commit: John Baldwin CommitDate: 2024-11-05 01:27:14 +0000 nvmf: Fix an off by one error when scanning active namespace IDs The active namespace list query fetches namespaces greater than the passed in namespace ID, not greater than or equal to the passed in namespace ID. Thus, a multi-page request should start with the last namespace ID from the previous page, not that ID plus 1. While here, make use of NVME_GLOBAL_NAMESPACE_TAG instead of a magic number to handle the edge case that the last namespace ID in a page is the largest valid namespace ID. Reviewed by: chuck Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D47393 --- sys/dev/nvmf/host/nvmf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/nvmf/host/nvmf.c b/sys/dev/nvmf/host/nvmf.c index 2c438db2eb23..804e7528c931 100644 --- a/sys/dev/nvmf/host/nvmf.c +++ b/sys/dev/nvmf/host/nvmf.c @@ -376,10 +376,10 @@ nvmf_scan_active_nslist(struct nvmf_softc *sc, struct nvme_ns_list *nslist, MPASS(nsid == nslist->ns[nitems(nslist->ns) - 1] && nsid != 0); - if (nsid >= 0xfffffffd) + if (nsid >= NVME_GLOBAL_NAMESPACE_TAG - 1) *nsidp = 0; else - *nsidp = nsid + 1; + *nsidp = nsid; return (true); }