[ovs-dev] [PATCH 01/13] Upstream GRE: Use RTNL for atomic protocol registration.

Jesse Gross jesse at nicira.com
Mon Dec 3 18:51:29 UTC 2012


On Thu, Nov 22, 2012 at 7:56 AM, Pravin B Shelar <pshelar at nicira.com> wrote:
> diff --git a/drivers/net/ppp/pptp.c b/drivers/net/ppp/pptp.c
> index 162464f..b76c151 100644
> --- a/drivers/net/ppp/pptp.c
> +++ b/drivers/net/ppp/pptp.c
> @@ -673,11 +673,14 @@ static int __init pptp_init_module(void)
>         if (!callid_sock)
>                 return -ENOMEM;
>
> +       rtnl_lock();
>         err = gre_add_protocol(&gre_pptp_protocol, GREPROTO_PPTP);
>         if (err) {
> +               rtnl_unlock();
>                 pr_err("PPTP: can't add gre protocol\n");
>                 goto out_mem_free;
>         }
> +       rtnl_unlock();

Can we simplify this (and ip_gre.c) a little bit by releasing the lock
immediately after gre_add_protocol()?  That way there would be only
one path to unlock and it's less likely that future changes will
introduce problems.



More information about the dev mailing list