All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme: fix build error: nvme_mpath_update stub without static
@ 2022-03-23 23:43 Anton Eidelman
  2022-03-24  0:30 ` [PATCH v2 0/2] Fix issues with nvme_mpath_update Anton Eidelman
  0 siblings, 1 reply; 9+ messages in thread
From: Anton Eidelman @ 2022-03-23 23:43 UTC (permalink / raw)
  To: linux-nvme, hch, kbusch, sagi, axboe; +Cc: Anton Eidelman, kernel test robot

Fix multiple definition of nvme_mpath_update() on
builds with CONFIG_NVME_MULTIPATH disabled:
the stub function is missing "static inline".

Fixes: d50c992edf10 ("nvme-multipath: fix hang when disk goes live over reconnect")

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Anton Eidelman <anton@lightbitslabs.com>
---
 drivers/nvme/host/nvme.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 76f7a5f37379..8cf90c9ed667 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -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)
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 0/2] Fix issues with nvme_mpath_update
  2022-03-23 23:43 [PATCH] nvme: fix build error: nvme_mpath_update stub without static Anton Eidelman
@ 2022-03-24  0:30 ` Anton Eidelman
  2022-03-24  0:30   ` [PATCH v2 1/2] nvme: fix build error: nvme_mpath_update stub without static Anton Eidelman
  2022-03-24  0:30   ` [PATCH v2 2/2] nvme/mpath: fix crash in nvme_mpath_update for non-ana ctrl Anton Eidelman
  0 siblings, 2 replies; 9+ messages in thread
From: Anton Eidelman @ 2022-03-24  0:30 UTC (permalink / raw)
  To: linux-nvme, hch, kbusch, sagi, axboe; +Cc: Anton Eidelman

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(-)

-- 
2.25.1



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 1/2] nvme: fix build error: nvme_mpath_update stub without static
  2022-03-24  0:30 ` [PATCH v2 0/2] Fix issues with nvme_mpath_update Anton Eidelman
@ 2022-03-24  0:30   ` Anton Eidelman
  2022-03-24  0:30   ` [PATCH v2 2/2] nvme/mpath: fix crash in nvme_mpath_update for non-ana ctrl Anton Eidelman
  1 sibling, 0 replies; 9+ messages in thread
From: Anton Eidelman @ 2022-03-24  0:30 UTC (permalink / raw)
  To: linux-nvme, hch, kbusch, sagi, axboe; +Cc: Anton Eidelman, kernel test robot

Fix multiple definition of nvme_mpath_update() on
builds with CONFIG_NVME_MULTIPATH disabled:
the stub function is missing "static inline".

Fixes: d50c992edf10 ("nvme-multipath: fix hang when disk goes live over reconnect")

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Anton Eidelman <anton@lightbitslabs.com>
---
 drivers/nvme/host/nvme.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 76f7a5f37379..8cf90c9ed667 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -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)
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 2/2] nvme/mpath: fix crash in nvme_mpath_update for non-ana ctrl
  2022-03-24  0:30 ` [PATCH v2 0/2] Fix issues with nvme_mpath_update Anton Eidelman
  2022-03-24  0:30   ` [PATCH v2 1/2] nvme: fix build error: nvme_mpath_update stub without static Anton Eidelman
@ 2022-03-24  0:30   ` Anton Eidelman
  2022-03-24  0:38     ` [PATCH v3 0/2] Fix issues with nvme_mpath_update Anton Eidelman
  1 sibling, 1 reply; 9+ messages in thread
From: Anton Eidelman @ 2022-03-24  0:30 UTC (permalink / raw)
  To: linux-nvme, hch, kbusch, sagi, axboe; +Cc: Anton Eidelman

When 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.

Fixes: d50c992edf10 ("nvme-multipath: fix hang when disk goes live over reconnect")
Signed-off-by: Anton Eidelman <anton@lightbitslabs.com>
---
 drivers/nvme/host/multipath.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index 12d4afde3662..f15badc0410a 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -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)
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v3 0/2] Fix issues with nvme_mpath_update
  2022-03-24  0:30   ` [PATCH v2 2/2] nvme/mpath: fix crash in nvme_mpath_update for non-ana ctrl Anton Eidelman
@ 2022-03-24  0:38     ` Anton Eidelman
  2022-03-24  0:38       ` [PATCH v3 1/2] nvme: fix build error: nvme_mpath_update stub without static Anton Eidelman
  2022-03-24  0:39       ` [PATCH v3 2/2] nvme/mpath: fix crash in nvme_mpath_update for non-ana ctrl Anton Eidelman
  0 siblings, 2 replies; 9+ messages in thread
From: Anton Eidelman @ 2022-03-24  0:38 UTC (permalink / raw)
  To: linux-nvme, hch, kbusch, sagi, axboe; +Cc: Anton Eidelman

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(-)

-- 
2.25.1



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v3 1/2] nvme: fix build error: nvme_mpath_update stub without static
  2022-03-24  0:38     ` [PATCH v3 0/2] Fix issues with nvme_mpath_update Anton Eidelman
@ 2022-03-24  0:38       ` Anton Eidelman
  2022-03-24  6:03         ` Christoph Hellwig
  2022-03-24  0:39       ` [PATCH v3 2/2] nvme/mpath: fix crash in nvme_mpath_update for non-ana ctrl Anton Eidelman
  1 sibling, 1 reply; 9+ messages in thread
From: Anton Eidelman @ 2022-03-24  0:38 UTC (permalink / raw)
  To: linux-nvme, hch, kbusch, sagi, axboe; +Cc: Anton Eidelman, kernel test robot

Fix multiple definition of nvme_mpath_update() on
builds with CONFIG_NVME_MULTIPATH disabled:
the stub function is missing "static inline".

Fixes: d50c992edf10 ("nvme-multipath: fix hang when disk goes live over reconnect")

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Anton Eidelman <anton@lightbitslabs.com>
---
 drivers/nvme/host/nvme.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 76f7a5f37379..8cf90c9ed667 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -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)
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v3 2/2] nvme/mpath: fix crash in nvme_mpath_update for non-ana ctrl
  2022-03-24  0:38     ` [PATCH v3 0/2] Fix issues with nvme_mpath_update Anton Eidelman
  2022-03-24  0:38       ` [PATCH v3 1/2] nvme: fix build error: nvme_mpath_update stub without static Anton Eidelman
@ 2022-03-24  0:39       ` Anton Eidelman
  2022-03-24  6:04         ` Christoph Hellwig
  1 sibling, 1 reply; 9+ messages in thread
From: Anton Eidelman @ 2022-03-24  0:39 UTC (permalink / raw)
  To: linux-nvme, hch, kbusch, sagi, axboe; +Cc: Anton Eidelman

When 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.

Fixes: d50c992edf10 ("nvme-multipath: fix hang when disk goes live over reconnect")
Signed-off-by: Anton Eidelman <anton@lightbitslabs.com>
---
 drivers/nvme/host/multipath.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index 12d4afde3662..d36f2543ebe1 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -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)
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v3 1/2] nvme: fix build error: nvme_mpath_update stub without static
  2022-03-24  0:38       ` [PATCH v3 1/2] nvme: fix build error: nvme_mpath_update stub without static Anton Eidelman
@ 2022-03-24  6:03         ` Christoph Hellwig
  0 siblings, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2022-03-24  6:03 UTC (permalink / raw)
  To: Anton Eidelman
  Cc: linux-nvme, hch, kbusch, sagi, axboe, Anton Eidelman, kernel test robot

On Wed, Mar 23, 2022 at 06:38:59PM -0600, Anton Eidelman wrote:
> Fix multiple definition of nvme_mpath_update() on
> builds with CONFIG_NVME_MULTIPATH disabled:
> 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.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v3 2/2] nvme/mpath: fix crash in nvme_mpath_update for non-ana ctrl
  2022-03-24  0:39       ` [PATCH v3 2/2] nvme/mpath: fix crash in nvme_mpath_update for non-ana ctrl Anton Eidelman
@ 2022-03-24  6:04         ` Christoph Hellwig
  0 siblings, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2022-03-24  6:04 UTC (permalink / raw)
  To: Anton Eidelman; +Cc: linux-nvme, hch, kbusch, sagi, axboe, Anton Eidelman

> diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
> index 12d4afde3662..d36f2543ebe1 100644
> --- a/drivers/nvme/host/multipath.c
> +++ b/drivers/nvme/host/multipath.c
> @@ -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);

Overly long line.  Kust retun early for the !ana_log_buf case
to sort this out trivially.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-03-24  6:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-23 23:43 [PATCH] nvme: fix build error: nvme_mpath_update stub without static Anton Eidelman
2022-03-24  0:30 ` [PATCH v2 0/2] Fix issues with nvme_mpath_update Anton Eidelman
2022-03-24  0:30   ` [PATCH v2 1/2] nvme: fix build error: nvme_mpath_update stub without static Anton Eidelman
2022-03-24  0:30   ` [PATCH v2 2/2] nvme/mpath: fix crash in nvme_mpath_update for non-ana ctrl Anton Eidelman
2022-03-24  0:38     ` [PATCH v3 0/2] Fix issues with nvme_mpath_update Anton Eidelman
2022-03-24  0:38       ` [PATCH v3 1/2] nvme: fix build error: nvme_mpath_update stub without static Anton Eidelman
2022-03-24  6:03         ` Christoph Hellwig
2022-03-24  0:39       ` [PATCH v3 2/2] nvme/mpath: fix crash in nvme_mpath_update for non-ana ctrl Anton Eidelman
2022-03-24  6:04         ` Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.