Skip to content

Commit

Permalink
RDMA/core: make ib_device.add method optional
Browse files Browse the repository at this point in the history
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.

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
  • Loading branch information
Sagi Grimberg authored and Doug Ledford committed Aug 18, 2017
1 parent 836daee commit b059e21
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/infiniband/core/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,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);
Expand Down Expand Up @@ -577,7 +577,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);
Expand Down

0 comments on commit b059e21

Please sign in to comment.