Skip to contentSkip to conversation

nvme-fc: fix numa_node when dev is null

PATCH In review James Smart 5 participants 5 messages Mar 1, 2019 – Mar 12, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme-fc: fix numa_node when dev is null

A recent change added a numa_node field to the nvme controller and has the transport assign the node using dev_to_node(). However, fcloop registers with a NULL device struct, so the dev_to_node() call oops.

Revise the assignment to assign no node when device struct is null.

Fixes 103e515efa89b ("nvme: add a numa_node field to struct nvme_ctrl")
Reported-by Mike Snitzer <snitzer at redhat.com>
Signed-off-by James Smart <jsmart2021 at gmail.com>
---
 drivers/nvme/host/fc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/host/fc.c +2 -1
index ba8f2a9cbdaf..865dc0637dbe 100644
@@ -3017,7 +3017,8 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
 
 	ctrl->ctrl.opts = opts;
 	ctrl->ctrl.nr_reconnects = 0;
-	ctrl->ctrl.numa_node = dev_to_node(lport->dev);
+	ctrl->ctrl.numa_node = (lport->dev) ?
+				dev_to_node(lport->dev) : NUMA_NO_NODE;
 	INIT_LIST_HEAD(&ctrl->ctrl_list);
 	ctrl->lport = lport;
 	ctrl->rport = rport;
Signature · 1 line
2.13.7
maintainer
#1 lore raw

PATCH 1/1 nvme-fc: fix numa_node when dev is null

Reviewed-by Sagi Grimberg <sagi at grimberg.me>
Reviewed-by on v1 1/1
#2 lore raw
In reply to James Smart
Quoted 10 lines · James Smart

A recent change added a numa_node field to the nvme controller and has the transport assign the node using dev_to_node(). However, fcloop registers with a NULL device struct, so the dev_to_node() call oops.

Revise the assignment to assign no node when device struct is null.

Fixes 103e515efa89b ("nvme: add a numa_node field to struct nvme_ctrl")
Reported-by Mike Snitzer <snitzer at redhat.com>
Signed-off-by James Smart <jsmart2021 at gmail.com>
Reviewed-by Mike Snitzer <snitzer at redhat.com>

Thanks James.

#3 lore raw

PATCH 1/1 nvme-fc: fix numa_node when dev is null

In reply to James Smart
Quoted 20 lines · James Smart

A recent change added a numa_node field to the nvme controller and has the transport assign the node using dev_to_node(). However, fcloop registers with a NULL device struct, so the dev_to_node() call oops.

Revise the assignment to assign no node when device struct is null.

Fixes 103e515efa89b ("nvme: add a numa_node field to struct nvme_ctrl")
Reported-by Mike Snitzer <snitzer at redhat.com>
Signed-off-by James Smart <jsmart2021 at gmail.com>
---
  drivers/nvme/host/fc.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/host/fc.c +0 -0
index ba8f2a9cbdaf..865dc0637dbe 100644

drivers/nvme/host/fc.c nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, · line 3024

Quoted 9 lines
drivers/nvme/host/fc.c +2 -1
@@ -3017,7 +3017,8 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
 
  	ctrl->ctrl.opts = opts;
  	ctrl->ctrl.nr_reconnects = 0;
-	ctrl->ctrl.numa_node = dev_to_node(lport->dev);
+	ctrl->ctrl.numa_node = (lport->dev) ?
+				dev_to_node(lport->dev) : NUMA_NO_NODE;
  	INIT_LIST_HEAD(&ctrl->ctrl_list);
  	ctrl->lport = lport;
  	ctrl->rport = rport;
Reviewed-by Hannes Reinecke <hare at suse.com>

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare at suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg
GF: F. Imend?rffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG N?rnberg)