[Lustre-devel] open(), getattr(), and negative dentries

Oleg Drokin green at whamcloud.com
Tue Jul 26 22:02:23 PDT 2011


Hello!

On Jul 21, 2011, at 4:15 PM, John Hammond wrote:

> It appears that stating a non-existent file on Lustre causes a negative
> dentry to be created, while opening it does not.  If I understand
> correctly, this also means that every open of a non-existent file that
> misses the dentry cache causes an RPC to the MDS.  Is there a reason for
> the difference?

Open does not return a parent dir lock back to the client and this is what guards
negative dentries.
So if you do ls -l on the dir, and then do your open (without O_CREATE!)
the negative dentry will be cached because of the pre-existing lock.
In fact is the dir was last modified sufficiently long ago (like several seconds have passed),
even lookup of the dir itself (even done as part of the path lookup to the filename)
would return you the needed lock and negative dentry will be cached.

Bye,
    Oleg
--
Oleg Drokin
Senior Software Engineer
Whamcloud, Inc.




More information about the lustre-devel mailing list