Skip to contentSkip to conversation

Allow ib_clients to nullify .add but still get .remove events reliably

PATCH Superseded Sagi Grimberg 3 participants 10 messages Jun 28, 2017

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Sagi Grimberg

author maintainer
#0 lore raw

cover Allow ib_clients to nullify .add but still get .remove events reliably

Some ULPs are just interested in device removal notification with no specific association because they work over RDMA_CM so no need for detecting appearance of the devices. That wasn't the because the corresponding ib_client_data was never added to the device clients list when the ib_client registers, Patch 1 fixes it. Patches 2-3 just removes the empty .add callout nvme(t)-rdma set.

Sagi Grimberg (3):
RDMA/device: Fix device removal notification when ib_clients set .add
callout to NULL
nvme-rdma: remove redundant empty device add callout
nvmet-rdma: remove redundant empty device add callout

 drivers/infiniband/core/device.c | 4 ++--
 drivers/nvme/host/rdma.c         | 5 -----
 drivers/nvme/target/rdma.c       | 5 -----
 3 files changed, 2 insertions(+), 12 deletions(-)
Signature · 1 line
2.7.4
author maintainer
#1 lore raw

PATCH 1/3 RDMA/device: Fix device removal notification when ib_clients set .add callout to NULL

ib_clients can indeed fill .add to NULL, but then they will not see any device removal notifications. The reason is that that ib_register_client and ib_register_device checked existence of .add before adding the creating a corresponding client_data and adding it to the list. Simple condition reverse fixes the issue.

Signed-off-by Sagi Grimberg <sagi at grimberg.me>
---
 drivers/infiniband/core/device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/core/device.c +2 -2
index 81d447da0048..26eb428af473 100644
@@ -414,7 +414,7 @@ int ib_register_device(struct ib_device *device,
 	device->reg_state = IB_DEV_REGISTERED;
 
 	list_for_each_entry(client, &client_list, list)
-		if (client->add && !add_client_context(device, client))
+		if (!add_client_context(device, client) && client->add)
 			client->add(device);
 
 	down_write(&lists_rwsem);
@@ -499,7 +499,7 @@ int ib_register_client(struct ib_client *client)
 	mutex_lock(&device_mutex);
 
 	list_for_each_entry(device, &device_list, core_list)
-		if (client->add && !add_client_context(device, client))
+		if (!add_client_context(device, client) && client->add)
 			client->add(device);
 
 	down_write(&lists_rwsem);
Signature · 1 line
2.7.4
#2 lore raw

PATCH 1/3 RDMA/device: Fix device removal notification when ib_clients set .add callout to NULL

Reviewed-by Johannes Thumshirn <jthumshirn at suse.de>
Signature · 6 lines
Johannes Thumshirn                                          Storage
jthumshirn at suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
#3 lore raw

PATCH 1/3 RDMA/device: Fix device removal notification when ib_clients set .add callout to NULL

In reply to Sagi Grimberg

The subject looks a bit odd to me, I'd say something like

RDMA/core: make ib_device.add method optional

Otherwise this looks good to me:

Reviewed-by Christoph Hellwig <hch at lst.de>
author maintainer
#4 lore raw

PATCH 2/3 nvme-rdma: remove redundant empty device add callout

In reply to Sagi Grimberg

Now that its not needed, we can simply not assign it.

Signed-off-by Sagi Grimberg <sagi at grimberg.me>
---
 drivers/nvme/host/rdma.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/nvme/host/rdma.c +0 -5
index 6d4119dfbdaa..934183f80fff 100644
@@ -1956,10 +1956,6 @@ static struct nvmf_transport_ops nvme_rdma_transport = {
 	.create_ctrl	= nvme_rdma_create_ctrl,
 };
 
-static void nvme_rdma_add_one(struct ib_device *ib_device)
-{
-}
-
 static void nvme_rdma_remove_one(struct ib_device *ib_device, void *client_data)
 {
 	struct nvme_rdma_ctrl *ctrl;
@@ -1981,7 +1977,6 @@ static void nvme_rdma_remove_one(struct ib_device *ib_device, void *client_data)
 
 static struct ib_client nvme_rdma_ib_client = {
 	.name   = "nvme_rdma",
-	.add = nvme_rdma_add_one,
 	.remove = nvme_rdma_remove_one
 };
 
Signature · 1 line
2.7.4
#5 lore raw

PATCH 2/3 nvme-rdma: remove redundant empty device add callout

Reviewed-by Johannes Thumshirn <jthumshirn at suse.de>
Signature · 6 lines
Johannes Thumshirn                                          Storage
jthumshirn at suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
author maintainer
#7 lore raw

PATCH 3/3 nvmet-rdma: remove redundant empty device add callout

In reply to Sagi Grimberg

Now that its not needed, we can simply not assign it.

Signed-off-by Sagi Grimberg <sagi at grimberg.me>
---
 drivers/nvme/target/rdma.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/nvme/target/rdma.c +0 -5
index 56a4cba690b5..76d2bb793afe 100644
@@ -1510,10 +1510,6 @@ static struct nvmet_fabrics_ops nvmet_rdma_ops = {
 	.delete_ctrl		= nvmet_rdma_delete_ctrl,
 };
 
-static void nvmet_rdma_add_one(struct ib_device *ib_device)
-{
-}
-
 static void nvmet_rdma_remove_one(struct ib_device *ib_device, void *client_data)
 {
 	struct nvmet_rdma_queue *queue;
@@ -1534,7 +1530,6 @@ static void nvmet_rdma_remove_one(struct ib_device *ib_device, void *client_data
 
 static struct ib_client nvmet_rdma_ib_client = {
 	.name   = "nvmet_rdma",
-	.add = nvmet_rdma_add_one,
 	.remove = nvmet_rdma_remove_one
 };
 
Signature · 1 line
2.7.4
#8 lore raw

PATCH 3/3 nvmet-rdma: remove redundant empty device add callout

Reviewed-by Johannes Thumshirn <jthumshirn at suse.de>
Signature · 6 lines
Johannes Thumshirn                                          Storage
jthumshirn at suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850