[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAM_iQpWcuX_aVzAgOEuUEiQY5MvUJhATUARm1KdqgaXbM7Sbxg@mail.gmail.com>
Date: Tue, 24 Mar 2015 10:21:51 -0700
From: Cong Wang <xiyou.wangcong@...il.com>
To: David Miller <davem@...emloft.net>
Cc: Linux Kernel Network Developers <netdev@...r.kernel.org>,
Stephen Hemminger <stephen@...workplumber.org>
Subject: Re: [Patch net-next] net: allow to delete a whole device group
On Tue, Mar 24, 2015 at 10:11 AM, David Miller <davem@...emloft.net> wrote:
> From: Cong Wang <xiyou.wangcong@...il.com>
> Date: Mon, 23 Mar 2015 17:04:15 -0700
>
>> + for_each_netdev_safe(net, dev, aux) {
>> + if (dev->group == group) {
>> + const struct rtnl_link_ops *ops;
>> +
>> + found = true;
>> + ops = dev->rtnl_link_ops;
>> + if (!ops || !ops->dellink)
>> + return -EOPNOTSUPP;
>> + ops->dellink(dev, &list_kill);
>> + }
>
> These semantics are terrible.
>
> A netlink request should always strive (no, I'll say it _must_) either
> fully perform the requested operation for all relevant objects, or
> have no side effects and return an error.
>
> If need be you must completely unwind all partial changes before
> returning that error, or alternatively defer commiting the
> changes until you can guarantee that all of them can be performed.
Good point.
I don't see a way to unwind the dellink, I think we can scan the list
twice, once for (!ops || !ops->dellink) check, once for dellink().
Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists