Skip to content

Commit c7c15ae

Browse files
Hou TaoChristoph Hellwig
authored andcommitted
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: Hou Tao <[email protected]> Reviewed-by: Keith Busch <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent 793fcab commit c7c15ae

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/nvme/host/multipath.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ int nvme_mpath_init_identify(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
866866
}
867867
if (ana_log_size > ctrl->ana_log_size) {
868868
nvme_mpath_stop(ctrl);
869-
kfree(ctrl->ana_log_buf);
869+
nvme_mpath_uninit(ctrl);
870870
ctrl->ana_log_buf = kmalloc(ana_log_size, GFP_KERNEL);
871871
if (!ctrl->ana_log_buf)
872872
return -ENOMEM;
@@ -886,4 +886,5 @@ void nvme_mpath_uninit(struct nvme_ctrl *ctrl)
886886
{
887887
kfree(ctrl->ana_log_buf);
888888
ctrl->ana_log_buf = NULL;
889+
ctrl->ana_log_size = 0;
889890
}

0 commit comments

Comments
 (0)