[PATCH 5/6] nvme: also return I/O command effects from nvme_command_effects
Keith Busch
kbusch at kernel.org
Wed Dec 21 13:42:47 PST 2022
On Wed, Dec 21, 2022 at 11:10:49AM +0100, Christoph Hellwig wrote:
> u32 nvme_command_effects(struct nvme_ctrl *ctrl, struct nvme_ns *ns, u8 opcode)
> {
> u32 effects = 0;
> @@ -1081,17 +1093,18 @@ u32 nvme_command_effects(struct nvme_ctrl *ctrl, struct nvme_ns *ns, u8 opcode)
> if (ns) {
> if (ns->head->effects)
> effects = le32_to_cpu(ns->head->effects->iocs[opcode]);
> + if (ns->head->ids.csi == NVME_CAP_CSS_NVM)
> + effects |= nvme_known_nvm_effects(opcode);
> if (effects & ~(NVME_CMD_EFFECTS_CSUPP | NVME_CMD_EFFECTS_LBCC))
> dev_warn_once(ctrl->device,
> - "IO command:%02x has unhandled effects:%08x\n",
> + "IO command:%02x has unusual effects:%08x\n",
> opcode, effects);
> - return 0;
> + } else {
> + if (ctrl->effects)
> + effects = le32_to_cpu(ctrl->effects->acs[opcode]);
> + effects |= nvme_known_admin_effects(opcode);
> }
>
> - if (ctrl->effects)
> - effects = le32_to_cpu(ctrl->effects->acs[opcode]);
> - effects |= nvme_known_admin_effects(opcode);
> -
> return effects;
Just noticed we need to mask out the CSE value for IO commands in case
some crazy controller sets it. If the driver were to see that value as
non-zero, it will freeze the IO queue the ioctl requires to to submit
its own IO request.
More information about the Linux-nvme
mailing list