<br><br><div class="gmail_quote">On Mon, Nov 28, 2011 at 12:19 PM, Vimal <span dir="ltr"><<a href="mailto:j.vimal@gmail.com">j.vimal@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi Rohan<br>
<br>
Yes, I understood this part, but I am wondering what is the purpose of<br>
this lock. I am guessing it's to protect all network related<br>
operations from critical events, for e.g.: protecting a packet<br>
transmit during device removal, protecting routing table entry during<br>
route lookup, etc., but I can't find its precise documentation<br>
anywhere. Thanks,<br>
<div><div></div><div class="h5"><br>
On 27 November 2011 22:44, rohan puri <<a href="mailto:rohan.puri15@gmail.com">rohan.puri15@gmail.com</a>> wrote:<br>
><br>
><br>
> On Sun, Nov 27, 2011 at 10:37 PM, Vimal <<a href="mailto:j.vimal@gmail.com">j.vimal@gmail.com</a>> wrote:<br>
>><br>
>> Hi all,<br>
>><br>
>> In the Linux networking code, I see a lot of comments that say "Must<br>
>> be called with RTNL lock."<br>
>><br>
>> What is this lock? I tried searching for it but couldn't find any<br>
>> explanation on what it is...<br>
>><br>
>> Thanks<br>
>> --<br>
>> Vimal<br>
>><br>
>> _______________________________________________<br>
>> Kernelnewbies mailing list<br>
>> <a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
>> <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
><br>
> Hello Vimal,<br>
> This is a mutex named rtnl_mutex. Refer file net/core/rtnetlink.c<br>
> static DEFINE_MUTEX(rtnl_mutex);<br>
><br>
> void rtnl_lock(void)<br>
> {<br>
> mutex_lock(&rtnl_mutex);<br>
> }<br>
> EXPORT_SYMBOL(rtnl_lock);<br>
> Where ever you see those comments indicate that this mutex is to be held<br>
> before execution of that code path.<br>
> Regards,<br>
> Rohan<br>
<br>
<br>
<br>
</div></div><font color="#888888">--<br>
Vimal<br>
</font></blockquote></div>This lock is used to serialize changes to net_device instances from runtime events, conf changes<div><br></div><div>Refer book understanding Linux network internals for more details.</div><div><br>
</div><div>Regards,</div><div>Rohan Puri</div>