<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>&nbsp;</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>&nbsp;</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>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</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>&nbsp;</o:p></p><p class=MsoNormal style='margin-bottom:12.0pt'><o:p>&nbsp;</o:p></p><div><p class=MsoNormal>On Mon, Nov 28, 2011 at 12:19 PM, Vimal &lt;<a href="mailto:j.vimal@gmail.com">j.vimal@gmail.com</a>&gt; 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. &nbsp; 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. &nbsp; 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 &lt;<a href="mailto:rohan.puri15@gmail.com">rohan.puri15@gmail.com</a>&gt; wrote:<br>&gt;<br>&gt;<br>&gt; On Sun, Nov 27, 2011 at 10:37 PM, Vimal &lt;<a href="mailto:j.vimal@gmail.com">j.vimal@gmail.com</a>&gt; wrote:<br>&gt;&gt;<br>&gt;&gt; Hi all,<br>&gt;&gt;<br>&gt;&gt; In the Linux networking code, I see a lot of comments that say &quot;Must<br>&gt;&gt; be called with RTNL lock.&quot;<br>&gt;&gt;<br>&gt;&gt; What is this lock? &nbsp;I tried searching for it but couldn't find any<br>&gt;&gt; explanation on what it is...<br>&gt;&gt;<br>&gt;&gt; Thanks<br>&gt;&gt; --<br>&gt;&gt; Vimal<br>&gt;&gt;<br>&gt;&gt; _______________________________________________<br>&gt;&gt; Kernelnewbies mailing list<br>&gt;&gt; <a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>&gt;&gt; <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>&gt;<br>&gt; Hello Vimal,<br>&gt; This is a mutex named rtnl_mutex. Refer file net/core/rtnetlink.c<br>&gt; static DEFINE_MUTEX(rtnl_mutex);<br>&gt;<br>&gt; void rtnl_lock(void)<br>&gt; {<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; mutex_lock(&amp;rtnl_mutex);<br>&gt; }<br>&gt; EXPORT_SYMBOL(rtnl_lock);<br>&gt; Where ever you see those comments indicate that this mutex is to be held<br>&gt; before execution of that code path.<br>&gt; Regards,<br>&gt; 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>&nbsp;</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>&nbsp;</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>