]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
nvme: fix command limits status code
authorKeith Busch <kbusch@kernel.org>
Tue, 20 May 2025 20:20:37 +0000 (13:20 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Jun 2025 13:32:18 +0000 (15:32 +0200)
[ Upstream commit 10f4a7cd724e34b7a6ff96e57ac49dc0cadececc ]

The command specific status code, 0x183, was introduced in the NVMe 2.0
specification defined to "Command Size Limits Exceeded" and only ever
applied to DSM and Copy commands.  Fix the name and, remove the
incorrect translation to error codes and special treatment in the
target code for it.

Fixes: 3b7c33b28a44d4 ("nvme.h: add Write Zeroes definitions")
Cc: Chaitanya Kulkarni <chaitanyak@nvidia.com>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/host/constants.c
drivers/nvme/host/core.c
drivers/nvme/host/pr.c
drivers/nvme/target/core.c
drivers/nvme/target/io-cmd-bdev.c
include/linux/nvme.h

index 2b9e6cfaf2a80ab86e7a537e04570d6c81841a6d..1a0058be5821044c9b98d2bcae0c1ad0ed4589ec 100644 (file)
@@ -145,7 +145,7 @@ static const char * const nvme_statuses[] = {
        [NVME_SC_BAD_ATTRIBUTES] = "Conflicting Attributes",
        [NVME_SC_INVALID_PI] = "Invalid Protection Information",
        [NVME_SC_READ_ONLY] = "Attempted Write to Read Only Range",
-       [NVME_SC_ONCS_NOT_SUPPORTED] = "ONCS Not Supported",
+       [NVME_SC_CMD_SIZE_LIM_EXCEEDED  ] = "Command Size Limits Exceeded",
        [NVME_SC_ZONE_BOUNDARY_ERROR] = "Zoned Boundary Error",
        [NVME_SC_ZONE_FULL] = "Zone Is Full",
        [NVME_SC_ZONE_READ_ONLY] = "Zone Is Read Only",
index 98dad1bdff440ab8b06924c01b76a1eecc118db0..eca764fede48f2eb5383dddaa566328841e88fd2 100644 (file)
@@ -284,7 +284,6 @@ static blk_status_t nvme_error_status(u16 status)
        case NVME_SC_NS_NOT_READY:
                return BLK_STS_TARGET;
        case NVME_SC_BAD_ATTRIBUTES:
-       case NVME_SC_ONCS_NOT_SUPPORTED:
        case NVME_SC_INVALID_OPCODE:
        case NVME_SC_INVALID_FIELD:
        case NVME_SC_INVALID_NS:
index dc7922f226004f60c165556066284bdd4f60c7f6..80dd09aa01a3b941f2048558143a63956f66014b 100644 (file)
@@ -82,8 +82,6 @@ static int nvme_status_to_pr_err(int status)
                return PR_STS_SUCCESS;
        case NVME_SC_RESERVATION_CONFLICT:
                return PR_STS_RESERVATION_CONFLICT;
-       case NVME_SC_ONCS_NOT_SUPPORTED:
-               return -EOPNOTSUPP;
        case NVME_SC_BAD_ATTRIBUTES:
        case NVME_SC_INVALID_OPCODE:
        case NVME_SC_INVALID_FIELD:
index ed2424f8a396e015d6debd1027dcb75795b673d5..4606c881366691c898d02269e7ccd618a85ab80c 100644 (file)
@@ -62,14 +62,7 @@ inline u16 errno_to_nvme_status(struct nvmet_req *req, int errno)
                return  NVME_SC_LBA_RANGE | NVME_STATUS_DNR;
        case -EOPNOTSUPP:
                req->error_loc = offsetof(struct nvme_common_command, opcode);
-               switch (req->cmd->common.opcode) {
-               case nvme_cmd_dsm:
-               case nvme_cmd_write_zeroes:
-                       return NVME_SC_ONCS_NOT_SUPPORTED | NVME_STATUS_DNR;
-               default:
-                       return NVME_SC_INVALID_OPCODE | NVME_STATUS_DNR;
-               }
-               break;
+               return NVME_SC_INVALID_OPCODE | NVME_STATUS_DNR;
        case -ENODATA:
                req->error_loc = offsetof(struct nvme_rw_command, nsid);
                return NVME_SC_ACCESS_DENIED;
index eaf31c823cbe88fc2b6500cad1bddaad1ca8c8b1..73ecbc13c5b23d8b96a81a82e8f508d3cbbb4b0b 100644 (file)
@@ -145,15 +145,8 @@ u16 blk_to_nvme_status(struct nvmet_req *req, blk_status_t blk_sts)
                req->error_loc = offsetof(struct nvme_rw_command, slba);
                break;
        case BLK_STS_NOTSUPP:
+               status = NVME_SC_INVALID_OPCODE | NVME_STATUS_DNR;
                req->error_loc = offsetof(struct nvme_common_command, opcode);
-               switch (req->cmd->common.opcode) {
-               case nvme_cmd_dsm:
-               case nvme_cmd_write_zeroes:
-                       status = NVME_SC_ONCS_NOT_SUPPORTED | NVME_STATUS_DNR;
-                       break;
-               default:
-                       status = NVME_SC_INVALID_OPCODE | NVME_STATUS_DNR;
-               }
                break;
        case BLK_STS_MEDIUM:
                status = NVME_SC_ACCESS_DENIED;
index 1c101f6fad2f31c1b574d10386fff679a6d5b59b..84d4f0657b7a8ec3b33e9bc62390573e85973952 100644 (file)
@@ -1954,7 +1954,7 @@ enum {
        NVME_SC_BAD_ATTRIBUTES          = 0x180,
        NVME_SC_INVALID_PI              = 0x181,
        NVME_SC_READ_ONLY               = 0x182,
-       NVME_SC_ONCS_NOT_SUPPORTED      = 0x183,
+       NVME_SC_CMD_SIZE_LIM_EXCEEDED   = 0x183,
 
        /*
         * I/O Command Set Specific - Fabrics commands: