Re: [PATCH] RDMA/device: Fix a race between mad_client and cm_client init

Jason Gunthorpe
2024-02-01T00:04:10Z

On Fri, Jan 26, 2024 at 10:25:01AM +0800, Shifeng Li wrote:
> > I believe this modification is effective, rather than expanding the clients_rwsem range,
> > the key point is down_write(&devices_rwsem), which prevents ib_register_client() from
> > being executed in the gap of ib_register_device().
> >
> > However, this may cause a little confusion, as ib_register_client() does not modify
> > anything related to devices, but it is protected by a write lock.
> >
> Do you have any differing opinions about above?

I'd rather see the client side have a comment explaining the confusing
lock then disturb the locking on the devices side..

I think the write/read lock scheme there was done for a reason I just
haven't had time to recall exactly why..

Please send a patch with this arrangement

Jason