[PATCH] nvme: do not update kato from a dsm io command
Keith Busch
kbusch at fb.com
Thu Aug 11 12:26:08 PDT 2022
From: Keith Busch <kbusch at kernel.org>
The Set Features Admin command shares the same opcode as the DSM IO
command (0x9). If the DSM's 'nr' field happens to match the KATO feature
ID (0xf), the driver will use a bogus keep-alive frequency.
Signed-off-by: Keith Busch <kbusch at kernel.org>
---
drivers/nvme/host/core.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index af367b22871b..7d49ca115cc5 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1111,7 +1111,7 @@ static u32 nvme_passthru_start(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
return effects;
}
-static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects,
+static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects, bool admin,
struct nvme_command *cmd, int status)
{
if (effects & NVME_CMD_EFFECTS_CSE_MASK) {
@@ -1128,6 +1128,9 @@ static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects,
flush_work(&ctrl->scan_work);
}
+ if (!admin)
+ return;
+
switch (cmd->common.opcode) {
case nvme_admin_set_features:
switch (le32_to_cpu(cmd->common.cdw10) & 0xFF) {
@@ -1160,7 +1163,7 @@ int nvme_execute_passthru_rq(struct request *rq)
effects = nvme_passthru_start(ctrl, ns, cmd->common.opcode);
ret = nvme_execute_rq(rq, false);
if (effects) /* nothing to be done for zero cmd effects */
- nvme_passthru_end(ctrl, effects, cmd, ret);
+ nvme_passthru_end(ctrl, effects, ns == NULL, cmd, ret);
return ret;
}
--
2.30.2
More information about the Linux-nvme
mailing list