Hi Jason, > -----Original Message----- > From: linux-rdma-owner@xxxxxxxxxxxxxxx <linux-rdma- > owner@xxxxxxxxxxxxxxx> On Behalf Of Jason Gunthorpe > Sent: Thursday, March 28, 2019 12:55 PM > To: Leon Romanovsky <leon@xxxxxxxxxx> > Cc: Doug Ledford <dledford@xxxxxxxxxx>; Leon Romanovsky > <leonro@xxxxxxxxxxxx>; RDMA mailing list <linux-rdma@xxxxxxxxxxxxxxx>; > Parav Pandit <parav@xxxxxxxxxxxx> > Subject: Re: [PATCH rdma-next v1 0/5] Disable device sharing in multiple net > namespace > > On Tue, Feb 26, 2019 at 02:01:44PM +0200, Leon Romanovsky wrote: > > From: Leon Romanovsky <leonro@xxxxxxxxxxxx> > > > > Changelog: > > v0->v1: > > * Rebased. > > * Addressed Doug's Jason's comment to not allow netns system > > mode change when non init_net namespaces exist. > > > > >From Parav: > > > > When there are multiple rdma devices exist in a system, it is desired > > to have per net namespace based devices without any compatibility > > devices. > > > > Therefore, add a query and set option through which user can > > disable/enable default mode of sharing a rdma device in multiple net > namespaces. > > > > In subsequent series, a new netlink command will be added to change > > the namespace of an rdma device. > > > > Thanks > > > > Parav Pandit (5): > > RDMA/core: Add module param to disable device sharing among net ns > > RDMA: Check net namespace access for uverbs, umad, cma and nldev > > RDMA/core: Extend ib_device_get_by_index for net namespace > > RDMA/core: Add interface to read device namespace sharing mode > > RDMA/core: Add command to set ib_core device net namspace sharing > > mode > > Applied to for-next, with this hunk as I noted, please check. Thanks > Below change looks good. Thanks, > diff --git a/drivers/infiniband/core/device.c > b/drivers/infiniband/core/device.c > index db123b2e9bcf0a..2dbd04739ac6d5 100644 > --- a/drivers/infiniband/core/device.c > +++ b/drivers/infiniband/core/device.c > @@ -1908,6 +1908,9 @@ int ib_enum_all_devs(nldev_callback nldev_cb, > struct sk_buff *skb, > > down_read(&devices_rwsem); > xa_for_each_marked (&devices, index, dev, DEVICE_REGISTERED) { > + if (!rdma_dev_access_netns(dev, sock_net(skb->sk))) > + continue; > + > ret = nldev_cb(dev, skb, cb, idx); > if (ret) > break; > diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c > index 0d70727920cda0..28b4ed8f9930e3 100644 > --- a/drivers/infiniband/core/nldev.c > +++ b/drivers/infiniband/core/nldev.c > @@ -686,14 +686,6 @@ static int _nldev_get_dumpit(struct ib_device > *device, > if (idx < start) > return 0; > > - if (!ib_device_try_get(device)) > - return 0; > - > - if (!rdma_dev_access_netns(device, sock_net(skb->sk))) { > - ib_device_put(device); > - return 0; > - } > - > nlh = nlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh- > >nlmsg_seq, > RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, > RDMA_NLDEV_CMD_GET), > 0, NLM_F_MULTI); > @@ -707,9 +699,7 @@ static int _nldev_get_dumpit(struct ib_device > *device, > > idx++; > > -out: > - ib_device_put(device); > - cb->args[0] = idx; > +out: cb->args[0] = idx; > return skb->len; > } > > @@ -889,14 +879,6 @@ static int _nldev_res_get_dumpit(struct ib_device > *device, > if (idx < start) > return 0; > > - if (!ib_device_try_get(device)) > - return 0; > - > - if (!rdma_dev_access_netns(device, sock_net(skb->sk))) { > - ib_device_put(device); > - return 0; > - } > - > nlh = nlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh- > >nlmsg_seq, > RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, > RDMA_NLDEV_CMD_RES_GET), > 0, NLM_F_MULTI); > @@ -911,7 +893,6 @@ static int _nldev_res_get_dumpit(struct ib_device > *device, > idx++; > > out: > - ib_device_put(device); > cb->args[0] = idx; > return skb->len; > }