<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Mangal;
        panose-1:2 4 5 3 5 2 3 3 2 2;}
@font-face
        {font-family:Mangal;
        panose-1:2 4 5 3 5 2 3 3 2 2;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-IN link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hi,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><a href="http://lists.openfabrics.org/pipermail/general/2008-July/052458.html">http://lists.openfabrics.org/pipermail/general/2008-July/052458.html</a><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>This might help you.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> kernelnewbies-bounces@kernelnewbies.org [mailto:kernelnewbies-bounces@kernelnewbies.org] <b>On Behalf Of </b>rohan puri<br><b>Sent:</b> 28 November 2011 12:36<br><b>To:</b> Vimal; kernelnewbies<br><b>Subject:</b> Re: What is RTNL lock?<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal style='margin-bottom:12.0pt'><o:p> </o:p></p><div><p class=MsoNormal>On Mon, Nov 28, 2011 at 12:19 PM, Vimal <<a href="mailto:j.vimal@gmail.com">j.vimal@gmail.com</a>> wrote:<o:p></o:p></p><p class=MsoNormal>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,<o:p></o:p></p><div><div><p class=MsoNormal style='margin-bottom:12.0pt'><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><o:p></o:p></p></div></div><p class=MsoNormal><span style='color:#888888'>--<br>Vimal</span><o:p></o:p></p></div><p class=MsoNormal>This lock is used to serialize changes to net_device instances from runtime events, conf changes<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Refer book understanding Linux network internals for more details.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Regards,<o:p></o:p></p></div><div><p class=MsoNormal>Rohan Puri<o:p></o:p></p></div></div></body></html>