Commit c7c15ae3 authored by Hou Tao's avatar Hou Tao Committed by Christoph Hellwig

nvme-multipath: set ana_log_size to 0 after free ana_log_buf

Set ana_log_size to 0 when ana_log_buf is freed to make sure
nvme_mpath_init_identify will do the right thing when retrying
after an earlier failure.
Signed-off-by: default avatarHou Tao <houtao1@huawei.com>
Reviewed-by: default avatarKeith Busch <kbusch@kernel.org>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 793fcab8
...@@ -866,7 +866,7 @@ int nvme_mpath_init_identify(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) ...@@ -866,7 +866,7 @@ int nvme_mpath_init_identify(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
} }
if (ana_log_size > ctrl->ana_log_size) { if (ana_log_size > ctrl->ana_log_size) {
nvme_mpath_stop(ctrl); nvme_mpath_stop(ctrl);
kfree(ctrl->ana_log_buf); nvme_mpath_uninit(ctrl);
ctrl->ana_log_buf = kmalloc(ana_log_size, GFP_KERNEL); ctrl->ana_log_buf = kmalloc(ana_log_size, GFP_KERNEL);
if (!ctrl->ana_log_buf) if (!ctrl->ana_log_buf)
return -ENOMEM; return -ENOMEM;
...@@ -886,4 +886,5 @@ void nvme_mpath_uninit(struct nvme_ctrl *ctrl) ...@@ -886,4 +886,5 @@ void nvme_mpath_uninit(struct nvme_ctrl *ctrl)
{ {
kfree(ctrl->ana_log_buf); kfree(ctrl->ana_log_buf);
ctrl->ana_log_buf = NULL; ctrl->ana_log_buf = NULL;
ctrl->ana_log_size = 0;
} }
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