kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* What is RTNL lock?
@ 2011-11-27 17:07 Vimal
       [not found] ` <CALJfu6O_njezhzH0By3_2tVDN8wpyCyCxebJR-gQFgK+NJKkQg@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Vimal @ 2011-11-27 17:07 UTC (permalink / raw)
  To: kernelnewbies

Hi all,

In the Linux networking code, I see a lot of comments that say "Must
be called with RTNL lock."

What is this lock?  I tried searching for it but couldn't find any
explanation on what it is...

Thanks
--
Vimal

^ permalink raw reply	[flat|nested] 3+ messages in thread

* What is RTNL lock?
       [not found]   ` <CAK3Ji10gW0iTSpnskkULDkRZTXorBjYzkTFPtYs-cE637FriyA@mail.gmail.com>
@ 2011-11-28  7:05     ` rohan puri
  2011-11-28  7:35       ` Pritam Bankar
  0 siblings, 1 reply; 3+ messages in thread
From: rohan puri @ 2011-11-28  7:05 UTC (permalink / raw)
  To: kernelnewbies

On Mon, Nov 28, 2011 at 12:19 PM, Vimal <j.vimal@gmail.com> wrote:

> Hi Rohan
>
> Yes, I understood this part, but I am wondering what is the purpose of
> this lock.   I am guessing it's to protect all network related
> operations from critical events, for e.g.: protecting a packet
> transmit during device removal, protecting routing table entry during
> route lookup, etc., but I can't find its precise documentation
> anywhere.   Thanks,
>
> On 27 November 2011 22:44, rohan puri <rohan.puri15@gmail.com> wrote:
> >
> >
> > On Sun, Nov 27, 2011 at 10:37 PM, Vimal <j.vimal@gmail.com> wrote:
> >>
> >> Hi all,
> >>
> >> In the Linux networking code, I see a lot of comments that say "Must
> >> be called with RTNL lock."
> >>
> >> What is this lock?  I tried searching for it but couldn't find any
> >> explanation on what it is...
> >>
> >> Thanks
> >> --
> >> Vimal
> >>
> >> _______________________________________________
> >> Kernelnewbies mailing list
> >> Kernelnewbies at kernelnewbies.org
> >> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> >
> > Hello Vimal,
> > This is a mutex named rtnl_mutex. Refer file net/core/rtnetlink.c
> > static DEFINE_MUTEX(rtnl_mutex);
> >
> > void rtnl_lock(void)
> > {
> >         mutex_lock(&rtnl_mutex);
> > }
> > EXPORT_SYMBOL(rtnl_lock);
> > Where ever you see those comments indicate that this mutex is to be held
> > before execution of that code path.
> > Regards,
> > Rohan
>
>
>
> --
> Vimal
>
This lock is used to serialize changes to net_device instances from runtime
events, conf changes

Refer book understanding Linux network internals for more details.

Regards,
Rohan Puri
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20111128/92aeb500/attachment.html 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* What is RTNL lock?
  2011-11-28  7:05     ` rohan puri
@ 2011-11-28  7:35       ` Pritam Bankar
  0 siblings, 0 replies; 3+ messages in thread
From: Pritam Bankar @ 2011-11-28  7:35 UTC (permalink / raw)
  To: kernelnewbies

Hi,

 

http://lists.openfabrics.org/pipermail/general/2008-July/052458.html

 

This might help you.

 

 

 

 

 

From: kernelnewbies-bounces@kernelnewbies.org
[mailto:kernelnewbies-bounces at kernelnewbies.org] On Behalf Of rohan puri
Sent: 28 November 2011 12:36
To: Vimal; kernelnewbies
Subject: Re: What is RTNL lock?

 

 

On Mon, Nov 28, 2011 at 12:19 PM, Vimal <j.vimal@gmail.com> wrote:

Hi Rohan

Yes, I understood this part, but I am wondering what is the purpose of
this lock.   I am guessing it's to protect all network related
operations from critical events, for e.g.: protecting a packet
transmit during device removal, protecting routing table entry during
route lookup, etc., but I can't find its precise documentation
anywhere.   Thanks,


On 27 November 2011 22:44, rohan puri <rohan.puri15@gmail.com> wrote:
>
>
> On Sun, Nov 27, 2011 at 10:37 PM, Vimal <j.vimal@gmail.com> wrote:
>>
>> Hi all,
>>
>> In the Linux networking code, I see a lot of comments that say "Must
>> be called with RTNL lock."
>>
>> What is this lock?  I tried searching for it but couldn't find any
>> explanation on what it is...
>>
>> Thanks
>> --
>> Vimal
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
> Hello Vimal,
> This is a mutex named rtnl_mutex. Refer file net/core/rtnetlink.c
> static DEFINE_MUTEX(rtnl_mutex);
>
> void rtnl_lock(void)
> {
>         mutex_lock(&rtnl_mutex);
> }
> EXPORT_SYMBOL(rtnl_lock);
> Where ever you see those comments indicate that this mutex is to be held
> before execution of that code path.
> Regards,
> Rohan




--
Vimal

This lock is used to serialize changes to net_device instances from runtime
events, conf changes

 

Refer book understanding Linux network internals for more details.

 

Regards,

Rohan Puri

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20111128/36231e74/attachment-0001.html 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-11-28  7:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-27 17:07 What is RTNL lock? Vimal
     [not found] ` <CALJfu6O_njezhzH0By3_2tVDN8wpyCyCxebJR-gQFgK+NJKkQg@mail.gmail.com>
     [not found]   ` <CAK3Ji10gW0iTSpnskkULDkRZTXorBjYzkTFPtYs-cE637FriyA@mail.gmail.com>
2011-11-28  7:05     ` rohan puri
2011-11-28  7:35       ` Pritam Bankar

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).