@@ -2951,18 +2951,20 @@ int nvme_get_log(struct nvme_ctrl *ctrl, u32 nsid, u8 log_page, u8 lsp, u8 csi,
return nvme_submit_sync_cmd(ctrl->admin_q, &c, log, size);
}
-static int nvme_get_effects_log(struct nvme_ctrl *ctrl, u8 csi,
- struct nvme_effects_log **log)
+static int nvme_get_effects_log(struct nvme_ctrl *ctrl, u8 csi, struct nvme_effects_log **log,
+ bool force)
{
struct nvme_cel *cel = xa_load(&ctrl->cels, csi);
int ret;
- if (cel)
+ if (cel && !force)
goto out;
- cel = kzalloc(sizeof(*cel), GFP_KERNEL);
- if (!cel)
- return -ENOMEM;
+ if (!cel) {
+ cel = kzalloc(sizeof(*cel), GFP_KERNEL);
+ if (!cel)
+ return -ENOMEM;
+ }
ret = nvme_get_log(ctrl, 0x00, NVME_LOG_CMD_EFFECTS, 0, csi,
&cel->log, sizeof(cel->log), 0);
@@ -3008,7 +3010,7 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
}
if (id->lpa & NVME_CTRL_LPA_CMD_EFFECTS_LOG) {
- ret = nvme_get_effects_log(ctrl, NVME_CSI_NVM, &ctrl->effects);
+ ret = nvme_get_effects_log(ctrl, NVME_CSI_NVM, &ctrl->effects, false);
if (ret < 0)
goto out_free;
}
@@ -3725,7 +3727,7 @@ static struct nvme_ns_head *nvme_alloc_ns_head(struct nvme_ctrl *ctrl,
}
if (head->ids.csi) {
- ret = nvme_get_effects_log(ctrl, head->ids.csi, &head->effects);
+ ret = nvme_get_effects_log(ctrl, head->ids.csi, &head->effects, false);
if (ret)
goto out_cleanup_srcu;
} else