Message ID | 1498983652-18250-2-git-send-email-sagi@grimberg.me (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
> 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> Any RDMA folks? -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, Jul 06, 2017 at 10:51:36AM +0300, Sagi Grimberg wrote: > > 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> > > Any RDMA folks? It looks right and two gentlemen above already reviewed it. Thanks, Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
>> Any RDMA folks? > > It looks right and two gentlemen above already reviewed it. None of them is focused on the RDMA core on a day-to-day basis. > Thanks, > Reviewed-by: Leon Romanovsky <leonro@mellanox.com> Awesome. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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);