Commit 5f8badbc authored by Amit's avatar Amit Committed by Sagi Grimberg

nvmet: fix a wrong error status returned in error log page

When the command data_len cannot hold all the controller errors,
we should simply return as much errors as we can fit
instead of failing the command.
Signed-off-by: default avatarAmit Engel <amit.engel@dell.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarSagi Grimberg <sagi@grimberg.me>
parent 85f8a435
...@@ -37,7 +37,6 @@ static void nvmet_execute_get_log_page_noop(struct nvmet_req *req) ...@@ -37,7 +37,6 @@ static void nvmet_execute_get_log_page_noop(struct nvmet_req *req)
static void nvmet_execute_get_log_page_error(struct nvmet_req *req) static void nvmet_execute_get_log_page_error(struct nvmet_req *req)
{ {
struct nvmet_ctrl *ctrl = req->sq->ctrl; struct nvmet_ctrl *ctrl = req->sq->ctrl;
u16 status = NVME_SC_SUCCESS;
unsigned long flags; unsigned long flags;
off_t offset = 0; off_t offset = 0;
u64 slot; u64 slot;
...@@ -47,9 +46,8 @@ static void nvmet_execute_get_log_page_error(struct nvmet_req *req) ...@@ -47,9 +46,8 @@ static void nvmet_execute_get_log_page_error(struct nvmet_req *req)
slot = ctrl->err_counter % NVMET_ERROR_LOG_SLOTS; slot = ctrl->err_counter % NVMET_ERROR_LOG_SLOTS;
for (i = 0; i < NVMET_ERROR_LOG_SLOTS; i++) { for (i = 0; i < NVMET_ERROR_LOG_SLOTS; i++) {
status = nvmet_copy_to_sgl(req, offset, &ctrl->slots[slot], if (nvmet_copy_to_sgl(req, offset, &ctrl->slots[slot],
sizeof(struct nvme_error_slot)); sizeof(struct nvme_error_slot)))
if (status)
break; break;
if (slot == 0) if (slot == 0)
...@@ -59,7 +57,7 @@ static void nvmet_execute_get_log_page_error(struct nvmet_req *req) ...@@ -59,7 +57,7 @@ static void nvmet_execute_get_log_page_error(struct nvmet_req *req)
offset += sizeof(struct nvme_error_slot); offset += sizeof(struct nvme_error_slot);
} }
spin_unlock_irqrestore(&ctrl->error_lock, flags); spin_unlock_irqrestore(&ctrl->error_lock, flags);
nvmet_req_complete(req, status); nvmet_req_complete(req, 0);
} }
static u16 nvmet_get_smart_log_nsid(struct nvmet_req *req, static u16 nvmet_get_smart_log_nsid(struct nvmet_req *req,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment