nvme: fix build error: nvme_mpath_update stub without static
PATCH 1/1 nvme: fix build error: nvme_mpath_update stub without static
Fix multiple definition of nvme_mpath_update() on
builds with CONFIG_NVME_MULTIPATH disabled:
the stub function is missing "static inline".
--- drivers/nvme/host/nvme.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/nvme.h +1 -1
@@ -853,7 +853,7 @@ static inline int nvme_mpath_init_identify(struct nvme_ctrl *ctrl, "Please enable CONFIG_NVME_MULTIPATH for full support of multi-port devices.\n");return 0 ; } -void nvme_mpath_update (struct nvme_ctrl *ctrl) +static inline void nvme_mpath_update (struct nvme_ctrl *ctrl) { }static inline void nvme_mpath_uninit (struct nvme_ctrl *ctrl)
Signature · 1 line
2.25.1
v2 cover Fix issues with nvme_mpath_update
My recent commit d50c992edf10
("nvme-multipath: fix hang when disk goes live over reconnect") introduced two issues:
1) Build error with CONFIG_NVME_MULTIPATH=n
- missing "static inline" for the nvme_mpath_update() stub.
2) Crash when CONFIG_NVME_MULTIPATH=y but
either multipath is off or the ctrl is not ANA-enabled.
Fixing both - sorry for inconvenience.
Anton Eidelman (2):
nvme: fix build error: nvme_mpath_update stub without static nvme/mpath: fix crash in nvme_mpath_update for non-ana ctrl
drivers/nvme/host/multipath.c | 10 ++++++---- drivers/nvme/host/nvme.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-)
Signature · 1 line
2.25.1
PATCH v2 1/2 nvme: fix build error: nvme_mpath_update stub without static
Fix multiple definition of nvme_mpath_update() on
builds with CONFIG_NVME_MULTIPATH disabled:
the stub function is missing "static inline".
--- drivers/nvme/host/nvme.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/nvme.h +1 -1
@@ -853,7 +853,7 @@ static inline int nvme_mpath_init_identify(struct nvme_ctrl *ctrl, "Please enable CONFIG_NVME_MULTIPATH for full support of multi-port devices.\n");return 0 ; } -void nvme_mpath_update (struct nvme_ctrl *ctrl) +static inline void nvme_mpath_update (struct nvme_ctrl *ctrl) { }static inline void nvme_mpath_uninit (struct nvme_ctrl *ctrl)
Signature · 1 line
2.25.1
PATCH v2 2/2 nvme/mpath: fix crash in nvme_mpath_update for non-ana ctrl
In reply to Anton EidelmanWhen CONFIG_NVME_MULTIPATH is enabled, the nvme_mpath_update() is called from nvme_start_ctrl()
for both ANA and non-ANA ctrls and regardless of multipath on/off.
Unless multipath is on and the ctrl is ANA-enabled the function will crash as the initializations
for ANA specific parts of the ctrl are skipped in such cases in nvme_mpath_init_identify().
Fix: check as done in nvme_handle_aen_notice() for ana_work:
a NULL ctrl->ana_log_buf indicates ctrl does not have ANA.
--- drivers/nvme/host/multipath.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/nvme/host/multipath.c +6 -4
@@ -712,11 +712,13 @@ static void nvme_ana_work(struct work_struct *work)void nvme_mpath_update (struct nvme_ctrl *ctrl) { -u32 nr_change_groups =0 ; +if (!ctrl->ana_log_buf) { +u32 nr_change_groups =0 ; -mutex_lock (&ctrl->ana_lock); -nvme_parse_ana_log (ctrl, &nr_change_groups, nvme_update_ana_state); -mutex_unlock (&ctrl->ana_lock); +mutex_lock (&ctrl->ana_lock); +nvme_parse_ana_log (ctrl, &nr_change_groups, nvme_update_ana_state); +mutex_unlock (&ctrl->ana_lock); + } }static void nvme_anatt_timeout (struct timer_list *t)
Signature · 1 line
2.25.1
v3 cover Fix issues with nvme_mpath_update
My recent commit d50c992edf10
("nvme-multipath: fix hang when disk goes live over reconnect") introduced two issues:
1) Build error with CONFIG_NVME_MULTIPATH=n
- missing "static inline" for the nvme_mpath_update() stub.
2) Crash when CONFIG_NVME_MULTIPATH=y but
either multipath is off or the ctrl is not ANA-enabled.
Fixing both - sorry for inconvenience.
Anton Eidelman (2):
nvme: fix build error: nvme_mpath_update stub without static nvme/mpath: fix crash in nvme_mpath_update for non-ana ctrl
drivers/nvme/host/multipath.c | 10 ++++++---- drivers/nvme/host/nvme.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-)
Signature · 1 line
2.25.1
PATCH v3 1/2 nvme: fix build error: nvme_mpath_update stub without static
Fix multiple definition of nvme_mpath_update() on
builds with CONFIG_NVME_MULTIPATH disabled:
the stub function is missing "static inline".
--- drivers/nvme/host/nvme.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/nvme.h +1 -1
@@ -853,7 +853,7 @@ static inline int nvme_mpath_init_identify(struct nvme_ctrl *ctrl, "Please enable CONFIG_NVME_MULTIPATH for full support of multi-port devices.\n");return 0 ; } -void nvme_mpath_update (struct nvme_ctrl *ctrl) +static inline void nvme_mpath_update (struct nvme_ctrl *ctrl) { }static inline void nvme_mpath_uninit (struct nvme_ctrl *ctrl)
Signature · 1 line
2.25.1
Christoph Hellwig
maintainerQuoted 3 lines · Anton Eidelman
Fix multiple definition of
nvme_mpath_update()on
builds withCONFIG_NVME_MULTIPATHdisabled:
the stub function is missing "static inline".
Please just resend a new patch. I've dropped the old one from the nvme-5.18 branch for now.
PATCH v3 2/2 nvme/mpath: fix crash in nvme_mpath_update for non-ana ctrl
In reply to Anton EidelmanWhen CONFIG_NVME_MULTIPATH is enabled, the nvme_mpath_update() is called from nvme_start_ctrl()
for both ANA and non-ANA ctrls and regardless of multipath on/off.
Unless multipath is on and the ctrl is ANA-enabled the function will crash as the initializations
for ANA specific parts of the ctrl are skipped in such cases in nvme_mpath_init_identify().
Fix: check as done in nvme_handle_aen_notice() for ana_work:
a NULL ctrl->ana_log_buf indicates ctrl does not have ANA.
--- drivers/nvme/host/multipath.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/nvme/host/multipath.c +6 -4
@@ -712,11 +712,13 @@ static void nvme_ana_work(struct work_struct *work)void nvme_mpath_update (struct nvme_ctrl *ctrl) { -u32 nr_change_groups =0 ; +if (ctrl->ana_log_buf) { +u32 nr_change_groups =0 ; -mutex_lock (&ctrl->ana_lock); -nvme_parse_ana_log (ctrl, &nr_change_groups, nvme_update_ana_state); -mutex_unlock (&ctrl->ana_lock); +mutex_lock (&ctrl->ana_lock); +nvme_parse_ana_log (ctrl, &nr_change_groups, nvme_update_ana_state); +mutex_unlock (&ctrl->ana_lock); + } }static void nvme_anatt_timeout (struct timer_list *t)
Signature · 1 line
2.25.1
Christoph Hellwig
maintainerRe: [PATCH v3 2/2] nvme/mpath: fix crash in nvme_mpath_update for non-ana ctrl
Quoted 7 lines
drivers/nvme/host/multipath.c +0
-0@@ -712,11 +712,13 @@ static void nvme_ana_work(struct work_struct *work)void nvme_mpath_update (struct nvme_ctrl *ctrl)
drivers/nvme/host/multipath.c static void nvme_ana_work(struct work_struct *work) · line 719
Quoted 10 lines
drivers/nvme/host/multipath.c +4
-4{ -u32 nr_change_groups =0 ; +if (ctrl->ana_log_buf) { +u32 nr_change_groups =0 ; -mutex_lock (&ctrl->ana_lock); -nvme_parse_ana_log (ctrl, &nr_change_groups, nvme_update_ana_state); -mutex_unlock (&ctrl->ana_lock); +mutex_lock (&ctrl->ana_lock); +nvme_parse_ana_log (ctrl, &nr_change_groups, nvme_update_ana_state);
Overly long line. Kust retun early for the !ana_log_buf case to sort this out trivially.