From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) (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 C0914493634 for ; Sat, 22 Aug 2026 21:53:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787435590; cv=none; b=HIvOFzAwIqhyo1sO5UyqqBwbYlDRBv0kSogZ9hnoPpX+LiNBg1od1WOlvrjclL+jtfme5euhcQXRxkuK3nwh3cWVHJQ4KdnRfD1VYI8Z1ZLjSrbILajFcyr8WcDd/zk0PVJjsi1J00+UnfUruAvfWrxuhQv9HJbft2WL/AsH4ac= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787435590; c=relaxed/simple; bh=/CfFUUF8xJfiCURWxR9SfItdW4lqgiVkaHajLxx5kXg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=G3xrg38gDUdXrcOg2F4BfZhRh0v6Jr2o7gXwNHqcdS3vghhpvbMs+bTAGw8kxZ1oSUusZ2VgpafTCckpYCPDSianBeiSvLP3VYztVCW30tUdONhPLNY51GZFvI7cfvfGrZFSZ8fvJiomzmggT+Xko/v3CIRddH53jAJjEwHBfn8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=grimberg.me; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.208.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=grimberg.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-69c108fee7fso3819200a12.3 for ; Sat, 22 Aug 2026 14:53:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787435587; x=1788040387; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=iW/Ek6Y2MPl84IGt7gfwNPvcZhF260WSBSWevUoFsBo=; b=TzhU5k/e5IlAfeKzmmuWrdqN4IZ8W5PLeX5txhFoHdhSwchwc78g2CUfd5B+wCwdsw q8D2uGdLW/62sOvmLzraEDfdl41dN9IJcLjGV4qIxyNRphf92qaLG5E/5C0m/0uFn2xW Gll4Qi1oDr/67gUsqQ7RXUYY9d9McIAq4lEWXHZjuitIM5I6aThNYgYO/a396MCuFHKQ OlZ1NvQ8txESErkm/HwPIBZgyHkk7sMYorBlGbkbyFVRzYYpcq9FC+hQbjAekefe6lob bWr5idD+QK5kNsWNRwaBWlZUHDs23Sf5ydaQaSlNO6pLl0gQz6URZFmzLyGhd/Uv9y0R NP8w== X-Forwarded-Encrypted: i=1; AHgh+Ro1WVLOnOkyXq0XzymQWe0djpYc8P5lVklp/ILZg3lu0vLBLXlOCaOiqrGfi35YcZnLk1VH4cnBD3g5kBk=@vger.kernel.org X-Gm-Message-State: AFuF++latN5dIoj48yrk4x95A2nxX4Vh192wfKEh3kDCa37M2cnH1LdE j5tML9RAGszetqEO6HDFWZqY8qLeWRj1QFzi/sPI21hh6j7CQEwBAo9o X-Gm-Gg: AR+sD13kV/C4rewicW2JFcYtns57rRVfQtedkHMHLSNkDjdgf2EUBg3taN2WPoDt5r7 iHoNl5aeKChabXe/n9G0OpUBaaQca/L+PXI40QHY0gI+YU4/fn19jV7WytYG0AGRvBKOYaL8M4F y2XRfWLxfpsJRK6ubj0yJBk61MY2yYt3krSYr4Q+/B5Zv9t8+erm17VzWdLBOPaKyYj58Y41e1g J6SxEp9m7RvciUVBl/9uByOSZN8FPQJk35/Hg0TEmbEAMgZq5bYovdnGT74V4almlM0FsSfN+j3 PxyfhKu3BLy+F9i8lmEWQ2fU1CqfI5GuKEnYyvkzmpXH2LTBjxU/E9nxUPwKeUxlLVGC7gQITPG 0jwGdGGVFc3XIgABG6j+3TtzrWS526/yUv2vfQc4KNouiPR5U9P9ZVfoZ+ViiFGnBCOpb80I4Lp kDd1IjX9/w0bnl3JNiSbtW4zOb+QKNjrb8HcPi36geVpoYMt+jG60oviHk+a/p7CL9niu9p3IMj xM87m4tOpCjwYVb3+X4tDOSkK0sPQpNVw== X-Received: by 2002:a05:6402:a50a:10b0:6a4:cc9:e32b with SMTP id 4fb4d7f45d1cf-6a582b608b0mr5720111a12.9.1787435586932; Sat, 22 Aug 2026 14:53:06 -0700 (PDT) Received: from [10.100.102.74] (89-138-65-240.bb.netvision.net.il. [89.138.65.240]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6a3ff170601sm13411347a12.25.2026.08.22.14.53.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 22 Aug 2026 14:53:06 -0700 (PDT) Message-ID: <4aa2e0d5-e519-4125-b537-e4b035d07847@grimberg.me> Date: Sun, 23 Aug 2026 00:53:05 +0300 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH] nvmet: passthru: use Invalid Field, not Invalid Opcode, for unhandled Get/Set Features FIDs To: Marko Ahvenainen , "hch@lst.de" , "kch@nvidia.com" Cc: "linux-nvme@lists.infradead.org" , "linux-kernel@vger.kernel.org" References: Content-Language: en-US From: Sagi Grimberg In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hey Marko, > Hello all, > > My first kernel patch, be gentle ;) > > nvmet_passthru_get_set_features() rejects any FID that reaches its > default case - whether intentionally blocked (IRQ_COALESCE, > IRQ_CONFIG, HOST_MEM_BUF, SW_PROGRESS, RESV_MASK, RESV_PERSIST) or > simply unlisted (e.g. FID 0, unassigned by the spec) - with > NVME_SC_INVALID_OPCODE | NVME_STATUS_DNR. That's the wrong class: the > Get/Set Features opcode is always valid here, it's the FID that's > rejected, so NVME_SC_INVALID_FIELD is correct. > > This surfaced while debugging why nvme-cli's "dump all known > features" mode (get-feature -f 0) completes against a native > controller but aborts over nvmet passthru: natively, FID 0 gets a > plain Invalid Field rejection (no DNR) that nvme-cli tolerates and > continues past; nvmet's Invalid Opcode + DNR is not tolerated the > same way. > > Verified with this fix applied: get-feature -f 0 now enumerates every > FID over nvmet passthru (NVMe/TCP) without aborting early. The DNR > flag was not the obstacle - only the status class was. > > This is a status-code fix only, not a policy change: Get/Set Features > FIDs are still intercepted at more than one layer before reaching > this function (nvmet_parse_admin_cmd()/nvmet_parse_passthru_admin_cmd() > already service ASYNC_EVENT, KATO, NUM_QUEUES, HOST_ID and FDP with > nvmet's own emulation), so native and passthru queries still won't > return identical results for every FID - only this early-abort > failure mode is fixed. I'd rather leave any broader forwarding-policy > change to a separate discussion. > > Unrelated aside noticed while reading this code: the > NVME_FEAT_ASYNC_EVENT case (and propably some other) inside this > function is dead code, since the callers above already intercept > that FID before it can be reached. > > Signed-off-by: Marko Ahvenainen > --- > drivers/nvme/target/passthru.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/nvme/target/passthru.c b/drivers/nvme/target/passthru.c > index e27f84e3cf2b..df1396081f87 100644 > --- a/drivers/nvme/target/passthru.c > +++ b/drivers/nvme/target/passthru.c > @@ -483,7 +483,7 @@ static u16 nvmet_passthru_get_set_features(struct nvmet_req *req) > case NVME_FEAT_RESV_PERSIST: > /* No reservations, see nvmet_parse_passthru_io_cmd() */ > default: > - return NVME_SC_INVALID_OPCODE | NVME_STATUS_DNR; > + return NVME_SC_INVALID_FIELD | NVME_STATUS_DNR; I think you want to set the error_loc such that it can be viewed from the error log page. > } > } > > -- > 2.43.0 You should make it a proper (non-rfc) patch and send it. The below should be removed from the actual submission. > > This e-mail and any attachments may contain privileged or confidential information and is for the sole use of the intended recipient(s). Any unauthorized use or disclosure of this communication is prohibited. If you believe that you have received this e-mail in error, please notify the sender immediately and destroy all copies.