<br><br><div class="gmail_quote">On Tue, Apr 3, 2012 at 6:20 AM, Xavier Hernandez <span dir="ltr">&lt;<a href="mailto:xhernandez@datalab.es">xhernandez@datalab.es</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello developers,<br>
<br>
I&#39;m currently trying to implement a new method for managing inode and entry modifications that will be faster (I hope) than the current method for the most common cases. To do so I need to know exactly how the locking mechanism works. I have been browsing the source code and doing some tests, and I would like to be sure that I have understood it correctly before continuing.<br>

<br>
All information is based on latest qa releases from 3.3 branch.<br>
<br>
My understanding is this:<br>
<br>
- There are three locking fops: lk, inodelk and entrylk.<br>
- Client application locks created using fcntl() are received by the translators as lk requests.<br>
- All other functionalities of lk fop are not currently used by any translator (I mean F_RESLK_LCK, F_RESLK_LCKW, F_RESLK_UNLCK and F_GETLK_FD).<br>
- inodelk and entrlylk are only used by AFR to lock inodes or directory entries before modification.<br>
- Translators don&#39;t generate lk requests internally.<br>
- Client application requests cannot directly generate an inodelk or entrylk requests.<br></blockquote><div><br></div><div>Correct so far.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

- inodelk and entrylk locks are always mandatory.<br></blockquote><div><br></div><div>inodelk and entrylk are always advisory. Never mandatory (at least so far)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

- lk locks may be mandatory or advisory.<br></blockquote><div><br></div><div>mandatory mode is not tested for a very long time.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

- lk and inodelk are independent from each other, meaning that a lock using lk will not be visible to inodelk and will not block it. inodelk won&#39;t block lk requests neither.<br>
- User requests can only be blocked by lk created locks</blockquote><div><br></div><div>Correct, and only if mandatory locks are enabled (which isn&#39;t tested right now)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
 (if a write request from user is allowed to pass without using inodelk, it won&#39;t be blocked by a previous inodelk).<br>
<br></blockquote><div><br></div><div>inodelks are never mandatory, so the question does not apply</div><div><br></div><div>Avati</div><div><br></div></div>