[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <474C1690.3010405@trash.net>
Date: Tue, 27 Nov 2007 14:07:28 +0100
From: Patrick McHardy <kaber@...sh.net>
To: Laszlo Attila Toth <panther@...abit.hu>
CC: David Miller <davem@...emloft.net>, netdev@...r.kernel.org,
netfilter-devel@...r.kernel.org
Subject: Re: [PATCHv6 1/3] rtnetlink: setlink changes are unprotected; with
single notification
Laszlo Attila Toth wrote:
> In do_setlink the device changes don't need to be protected. Notification
> is sent at the end of the function once if any modification occured
> and once if an address has been changed.
>
> Signed-off-by: Laszlo Attila Toth <panther@...abit.hu>
> ---
> net/core/rtnetlink.c | 32 ++++++++++++++++++++------------
> 1 files changed, 20 insertions(+), 12 deletions(-)
>
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index 4a07e83..20cb67e 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -542,7 +542,7 @@ int rtnl_put_cacheinfo(struct sk_buff *skb, struct dst_entry *dst, u32 id,
>
> EXPORT_SYMBOL_GPL(rtnl_put_cacheinfo);
>
> -static void set_operstate(struct net_device *dev, unsigned char transition)
> +static int set_operstate(struct net_device *dev, unsigned char transition)
> {
> unsigned char operstate = dev->operstate;
>
> @@ -562,11 +562,10 @@ static void set_operstate(struct net_device *dev, unsigned char transition)
> }
>
> if (dev->operstate != operstate) {
> - write_lock_bh(&dev_base_lock);
> dev->operstate = operstate;
> - write_unlock_bh(&dev_base_lock);
> - netdev_state_change(dev);
> - }
> + return 1;
> + } else
> + return 0;
The locking changes belong in a seperate patch with an explanation.
>
> - if (tb[IFLA_OPERSTATE])
> - set_operstate(dev, nla_get_u8(tb[IFLA_OPERSTATE]));
> + if (tb[IFLA_OPERSTATE]) {
> + modified |= set_operstate(dev, nla_get_u8(tb[IFLA_OPERSTATE]));
> + }
Please don't add braces here.
The rest looks fine.
-
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