No, to add a dentry to hash client needs holding LOOKUP lock, but lustre client unhash (see ll_unhash_aliases()) doesn't really remove dentry from hash, but set LUSTRE_DCACHE_INVALID flag. So in the race you mentioned, another process may add the dentry but later the lock is canceled soon, so at the time of revalidate, it needs to do a real lookup.<br>
<br><div class="gmail_quote">On Wed, Jan 11, 2012 at 10:06 PM,  <span dir="ltr"><<a href="mailto:tao.peng@emc.com">tao.peng@emc.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
I was reading dcache.c and following comments in ll_revalidate_it() seem confusing. Does it mean llite can hash a positive dentry to dcache without taking inode LOOKUP lock?<br>
<br>
589         /*<br>
590          * This part is here to combat evil-evil race in real_lookup on 2.6<br>
591          * kernels.  The race details are: We enter do_lookup() looking for some<br>
592          * name, there is nothing in dcache for this name yet and d_lookup()<br>
593          * returns NULL.  We proceed to real_lookup(), and while we do this,<br>
594          * another process does open on the same file we looking up (most simple<br>
595          * reproducer), open succeeds and the dentry is added. Now back to<br>
596          * us. In real_lookup() we do d_lookup() again and suddenly find the<br>
597          * dentry, so we call d_revalidate on it, but there is no lock, so<br>
598          * without this code we would return 0, but unpatched real_lookup just<br>
599          * returns -ENOENT in such a case instead of retrying the lookup. Once<br>
600          * this is dealt with in real_lookup(), all of this ugly mess can go and<br>
601          * we can just check locks in ->d_revalidate without doing any RPCs<br>
602          * ever.<br>
603          */<br>
<br>
Best Regards,<br>
Tao<br>
<br>
<br>
_______________________________________________<br>
Lustre-discuss mailing list<br>
<a href="mailto:Lustre-discuss@lists.lustre.org">Lustre-discuss@lists.lustre.org</a><br>
<a href="http://lists.lustre.org/mailman/listinfo/lustre-discuss" target="_blank">http://lists.lustre.org/mailman/listinfo/lustre-discuss</a><br>
</blockquote></div><br>