Allow ib_clients to nullify .add but still get .remove events reliably
Subsystems (3)
Sagi Grimberg
maintainercover 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
Sagi Grimberg
maintainerPATCH 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.
--- drivers/infiniband/core/device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/core/device.c +2 -2
@@ -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
PATCH 1/3 RDMA/device: Fix device removal notification when ib_clients set .add callout to NULL
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
Christoph Hellwig
maintainerPATCH 1/3 RDMA/device: Fix device removal notification when ib_clients set .add callout to NULL
In reply to Sagi GrimbergThe 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:
Sagi Grimberg
maintainerPATCH 2/3 nvme-rdma: remove redundant empty device add callout
In reply to Sagi GrimbergNow that its not needed, we can simply not assign it.
--- drivers/nvme/host/rdma.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/nvme/host/rdma.c +0 -5
@@ -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
PATCH 2/3 nvme-rdma: remove redundant empty device add callout
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
Christoph Hellwig
maintainerPATCH 2/3 nvme-rdma: remove redundant empty device add callout
In reply to Sagi GrimbergLooks good,
Sagi Grimberg
maintainerPATCH 3/3 nvmet-rdma: remove redundant empty device add callout
In reply to Sagi GrimbergNow that its not needed, we can simply not assign it.
--- drivers/nvme/target/rdma.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/nvme/target/rdma.c +0 -5
@@ -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_datastatic 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
PATCH 3/3 nvmet-rdma: remove redundant empty device add callout
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
Christoph Hellwig
maintainerPATCH 3/3 nvmet-rdma: remove redundant empty device add callout
In reply to Sagi GrimbergLooks good,