[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211129135307.mxtfw6j7v4hdex4f@kgollan-pc>
Date: Mon, 29 Nov 2021 15:53:08 +0200
From: Lahav Schlesinger <lschlesinger@...venets.com>
To: David Ahern <dsahern@...il.com>
Cc: Leon Romanovsky <leon@...nel.org>, netdev@...r.kernel.org,
kuba@...nel.org
Subject: Re: [PATCH net-next v3] rtnetlink: Support fine-grained netdevice
bulk deletion
On Sun, Nov 28, 2021 at 12:17:30PM -0700, David Ahern wrote:
> CAUTION: External E-Mail - Use caution with links and attachments
>
>
> On 11/28/21 4:43 AM, Leon Romanovsky wrote:
> >>>> +static int rtnl_list_dellink(struct net *net, int *ifindices, int size)
> >>>> +{
> >>>> + const int num_devices = size / sizeof(int);
> >>>> + struct net_device **dev_list;
> >>>> + LIST_HEAD(list_kill);
> >>>> + int i, ret;
> >>>> +
> >>>> + if (size <= 0 || size % sizeof(int))
> >>>> + return -EINVAL;
> >>>> +
> >>>> + dev_list = kmalloc_array(num_devices, sizeof(*dev_list), GFP_KERNEL);
> >>>> + if (!dev_list)
> >>>> + return -ENOMEM;
> >>>> +
> >>>> + for (i = 0; i < num_devices; i++) {
> >>>> + const struct rtnl_link_ops *ops;
> >>>> + struct net_device *dev;
> >>>> +
> >>>> + ret = -ENODEV;
> >>>> + dev = __dev_get_by_index(net, ifindices[i]);
> >>>> + if (!dev)
> >>>> + goto out_free;
> >>>> +
> >>>> + ret = -EOPNOTSUPP;
> >>>> + ops = dev->rtnl_link_ops;
> >>>> + if (!ops || !ops->dellink)
> >>>> + goto out_free;
> >>>
> >>> I'm just curious, how does user know that specific device doesn't
> >>> have ->delink implementation? It is important to know because you
> >>> are failing whole batch deletion. At least for single delink, users
> >>> have chance to skip "failed" one and continue.
> >>>
> >>> Thanks
> >>
> >> Hi Leon, I don't see any immediate way users can get this information.
> >> I do think that failing the whole request is better than silently
> >> ignoring such devices.
> >
> > I don't have any preference here, probably "fail all" is the easiest
> > solution here.
>
> Since there is no API to say which devices can not be deleted failing
> the group delete because 1 is say a physical device is going to be
> frustrating for users. I think the better approach is to delete what you
> can and set extack message to 'Some devices can not be deleted.'
>
Hi David, while I also don't have any strong preference here, my
reasoning for failing the whole request if one device can't be deleted
was so it will share the behaviour we currently have with group deletion.
If you're okay with this asymmetry I'll send a V4.
Powered by blists - more mailing lists