On Aug 28 00:20, 卢长奇 wrote:
> Hi,
> 
> I want to know if I understand it correctly.
> 
> ```
> static void nvme_aio_err(NvmeRequest *req, int ret)
> {
> uint16_t status = NVME_SUCCESS;
> Error *local_err = NULL;
> 
> switch (req->cmd.opcode) {
> case NVME_CMD_READ:
> case NVME_CMD_RESV_REPORT:
> status = NVME_UNRECOVERED_READ;
> break;
> case NVME_CMD_FLUSH:
> case NVME_CMD_WRITE:
> case NVME_CMD_WRITE_ZEROES:
> case NVME_CMD_ZONE_APPEND:
> case NVME_CMD_COPY:
> case NVME_CMD_RESV_REGISTER:
> case NVME_CMD_RESV_ACQUIRE:
> case NVME_CMD_RESV_RELEASE:
> status = NVME_WRITE_FAULT;
> break;
> default:
> status = NVME_INTERNAL_DEV_ERROR;
> break;
> }
> 
> trace_pci_nvme_err_aio(nvme_cid(req), strerror(-ret), status);
> 
> error_setg_errno(&local_err, -ret, "aio failed");
> error_report_err(local_err);
> 
> /*
> * Set the command status code to the first encountered error but
> allow a
> * subsequent Internal Device Error to trump it.
> */
> if (req->status && status != NVME_INTERNAL_DEV_ERROR) {
> return;
> }
> 
> req->status = status;
> }
> ```
> In the above use case, if it is a pr-related command and the error code
> is not supported, the invalid error code should be returned instead of
> the Fault error code.
> 

Yes, as far as I can tell from the spec, if a Reservations related
command is issued on a controller/namespace that does not BOTH support
Reservations (i.e., in ONCS and RESCAP), then return Invalid Command
Opcode.

Attachment: signature.asc
Description: PGP signature

Reply via email to