Re: [RFC PATCH rdma-next v1] RDMA/srp: Rename SRP sysfs name after IB device rename trigger

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 15, 2019 at 04:20:26PM +0300, Leon Romanovsky wrote:
> 
> diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
> index a67aaf0e1f76..64f777e757f6 100644
> +++ b/drivers/infiniband/core/device.c
> @@ -410,6 +410,9 @@ static int rename_compat_devs(struct ib_device *device)
> 
>  int ib_device_rename(struct ib_device *ibdev, const char *name)
>  {
> +	struct ib_client *client;
> +	unsigned long index;
> +	void *client_data;
>  	int ret;
> 
>  	down_write(&devices_rwsem);
> @@ -428,6 +431,19 @@ int ib_device_rename(struct ib_device *ibdev, const char *name)
>  		goto out;
>  	strlcpy(ibdev->name, name, IB_DEVICE_NAME_MAX);
>  	ret = rename_compat_devs(ibdev);
> +
> +	downgrade_write(&devices_rwsem);
> +	down_read(&clients_rwsem);
> +	xa_for_each_marked (&clients, index, client, CLIENT_REGISTERED) {
> +		if (client->rename) {

This isn't the right iteration for clients.. It has to iterate the
same way ib_get_net_dev_by_params() does it, otherwise there are races
if the client is concurrently unregistering.

Jason




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux