Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Allow ib_clients to nullify .add but still get .remove events reliably
@ 2017-06-28 10:05 Sagi Grimberg
  2017-06-28 10:05 ` [PATCH 1/3] RDMA/device: Fix device removal notification when ib_clients set .add callout to NULL Sagi Grimberg
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Sagi Grimberg @ 2017-06-28 10:05 UTC (permalink / raw)


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

-- 
2.7.4

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

* [PATCH 1/3] RDMA/device: Fix device removal notification when ib_clients set .add callout to NULL
  2017-06-28 10:05 [PATCH 0/3] Allow ib_clients to nullify .add but still get .remove events reliably Sagi Grimberg
@ 2017-06-28 10:05 ` Sagi Grimberg
  2017-06-28 12:40   ` Johannes Thumshirn
  2017-06-28 14:16   ` Christoph Hellwig
  2017-06-28 10:05 ` [PATCH 2/3] nvme-rdma: remove redundant empty device add callout Sagi Grimberg
  2017-06-28 10:05 ` [PATCH 3/3] nvmet-rdma: " Sagi Grimberg
  2 siblings, 2 replies; 10+ messages in thread
From: Sagi Grimberg @ 2017-06-28 10:05 UTC (permalink / raw)


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

diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 81d447da0048..26eb428af473 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -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);
-- 
2.7.4

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

* [PATCH 2/3] nvme-rdma: remove redundant empty device add callout
  2017-06-28 10:05 [PATCH 0/3] Allow ib_clients to nullify .add but still get .remove events reliably Sagi Grimberg
  2017-06-28 10:05 ` [PATCH 1/3] RDMA/device: Fix device removal notification when ib_clients set .add callout to NULL Sagi Grimberg
@ 2017-06-28 10:05 ` Sagi Grimberg
  2017-06-28 12:39   ` Johannes Thumshirn
  2017-06-28 14:16   ` Christoph Hellwig
  2017-06-28 10:05 ` [PATCH 3/3] nvmet-rdma: " Sagi Grimberg
  2 siblings, 2 replies; 10+ messages in thread
From: Sagi Grimberg @ 2017-06-28 10:05 UTC (permalink / raw)


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

diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
index 6d4119dfbdaa..934183f80fff 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -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
 };
 
-- 
2.7.4

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

* [PATCH 3/3] nvmet-rdma: remove redundant empty device add callout
  2017-06-28 10:05 [PATCH 0/3] Allow ib_clients to nullify .add but still get .remove events reliably Sagi Grimberg
  2017-06-28 10:05 ` [PATCH 1/3] RDMA/device: Fix device removal notification when ib_clients set .add callout to NULL Sagi Grimberg
  2017-06-28 10:05 ` [PATCH 2/3] nvme-rdma: remove redundant empty device add callout Sagi Grimberg
@ 2017-06-28 10:05 ` Sagi Grimberg
  2017-06-28 12:39   ` Johannes Thumshirn
  2017-06-28 14:16   ` Christoph Hellwig
  2 siblings, 2 replies; 10+ messages in thread
From: Sagi Grimberg @ 2017-06-28 10:05 UTC (permalink / raw)


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

diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c
index 56a4cba690b5..76d2bb793afe 100644
--- a/drivers/nvme/target/rdma.c
+++ b/drivers/nvme/target/rdma.c
@@ -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
 };
 
-- 
2.7.4

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

* [PATCH 2/3] nvme-rdma: remove redundant empty device add callout
  2017-06-28 10:05 ` [PATCH 2/3] nvme-rdma: remove redundant empty device add callout Sagi Grimberg
@ 2017-06-28 12:39   ` Johannes Thumshirn
  2017-06-28 14:16   ` Christoph Hellwig
  1 sibling, 0 replies; 10+ messages in thread
From: Johannes Thumshirn @ 2017-06-28 12:39 UTC (permalink / raw)



Reviewed-by: Johannes Thumshirn <jthumshirn at suse.de>
-- 
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

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

* [PATCH 3/3] nvmet-rdma: remove redundant empty device add callout
  2017-06-28 10:05 ` [PATCH 3/3] nvmet-rdma: " Sagi Grimberg
@ 2017-06-28 12:39   ` Johannes Thumshirn
  2017-06-28 14:16   ` Christoph Hellwig
  1 sibling, 0 replies; 10+ messages in thread
From: Johannes Thumshirn @ 2017-06-28 12:39 UTC (permalink / raw)



Reviewed-by: Johannes Thumshirn <jthumshirn at suse.de>
-- 
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

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

* [PATCH 1/3] RDMA/device: Fix device removal notification when ib_clients set .add callout to NULL
  2017-06-28 10:05 ` [PATCH 1/3] RDMA/device: Fix device removal notification when ib_clients set .add callout to NULL Sagi Grimberg
@ 2017-06-28 12:40   ` Johannes Thumshirn
  2017-06-28 14:16   ` Christoph Hellwig
  1 sibling, 0 replies; 10+ messages in thread
From: Johannes Thumshirn @ 2017-06-28 12:40 UTC (permalink / raw)



Reviewed-by: Johannes Thumshirn <jthumshirn at suse.de>
-- 
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

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

* [PATCH 1/3] RDMA/device: Fix device removal notification when ib_clients set .add callout to NULL
  2017-06-28 10:05 ` [PATCH 1/3] RDMA/device: Fix device removal notification when ib_clients set .add callout to NULL Sagi Grimberg
  2017-06-28 12:40   ` Johannes Thumshirn
@ 2017-06-28 14:16   ` Christoph Hellwig
  1 sibling, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2017-06-28 14:16 UTC (permalink / raw)


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>

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

* [PATCH 2/3] nvme-rdma: remove redundant empty device add callout
  2017-06-28 10:05 ` [PATCH 2/3] nvme-rdma: remove redundant empty device add callout Sagi Grimberg
  2017-06-28 12:39   ` Johannes Thumshirn
@ 2017-06-28 14:16   ` Christoph Hellwig
  1 sibling, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2017-06-28 14:16 UTC (permalink / raw)


Looks good,

Reviewed-by: Christoph Hellwig <hch at lst.de>

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

* [PATCH 3/3] nvmet-rdma: remove redundant empty device add callout
  2017-06-28 10:05 ` [PATCH 3/3] nvmet-rdma: " Sagi Grimberg
  2017-06-28 12:39   ` Johannes Thumshirn
@ 2017-06-28 14:16   ` Christoph Hellwig
  1 sibling, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2017-06-28 14:16 UTC (permalink / raw)


Looks good,

Reviewed-by: Christoph Hellwig <hch at lst.de>

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

end of thread, other threads:[~2017-06-28 14:16 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-28 10:05 [PATCH 0/3] Allow ib_clients to nullify .add but still get .remove events reliably Sagi Grimberg
2017-06-28 10:05 ` [PATCH 1/3] RDMA/device: Fix device removal notification when ib_clients set .add callout to NULL Sagi Grimberg
2017-06-28 12:40   ` Johannes Thumshirn
2017-06-28 14:16   ` Christoph Hellwig
2017-06-28 10:05 ` [PATCH 2/3] nvme-rdma: remove redundant empty device add callout Sagi Grimberg
2017-06-28 12:39   ` Johannes Thumshirn
2017-06-28 14:16   ` Christoph Hellwig
2017-06-28 10:05 ` [PATCH 3/3] nvmet-rdma: " Sagi Grimberg
2017-06-28 12:39   ` Johannes Thumshirn
2017-06-28 14:16   ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox