From: David Ahern <dsahern@gmail.com>
To: Leon Romanovsky <leon@kernel.org>,
Lahav Schlesinger <lschlesinger@drivenets.com>
Cc: netdev@vger.kernel.org, kuba@kernel.org
Subject: Re: [PATCH net-next v3] rtnetlink: Support fine-grained netdevice bulk deletion
Date: Sun, 28 Nov 2021 12:17:30 -0700 [thread overview]
Message-ID: <09296394-a69a-ee66-0897-c9018185cfde@gmail.com> (raw)
In-Reply-To: <YaNrd6+9V18ku+Vk@unreal>
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.'
next prev parent reply other threads:[~2021-11-28 19:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-25 16:51 [PATCH net-next v3] rtnetlink: Support fine-grained netdevice bulk deletion Lahav Schlesinger
2021-11-28 7:33 ` Leon Romanovsky
2021-11-28 11:13 ` Lahav Schlesinger
2021-11-28 11:43 ` Leon Romanovsky
2021-11-28 19:17 ` David Ahern [this message]
2021-11-29 13:53 ` Lahav Schlesinger
2021-11-29 15:30 ` David Ahern
2021-11-29 18:10 ` Jakub Kicinski
2021-11-29 19:14 ` David Ahern
2021-11-30 8:04 ` Nicolas Dichtel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=09296394-a69a-ee66-0897-c9018185cfde@gmail.com \
--to=dsahern@gmail.com \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=lschlesinger@drivenets.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).