[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <09296394-a69a-ee66-0897-c9018185cfde@gmail.com>
Date: Sun, 28 Nov 2021 12:17:30 -0700
From: David Ahern <dsahern@...il.com>
To: Leon Romanovsky <leon@...nel.org>,
Lahav Schlesinger <lschlesinger@...venets.com>
Cc: netdev@...r.kernel.org, kuba@...nel.org
Subject: Re: [PATCH net-next v3] rtnetlink: Support fine-grained netdevice
bulk deletion
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.'
Powered by blists - more mailing lists