John Hammond
2011-Jul-21 20:15 UTC
[Lustre-devel] open(), getattr(), and negative dentries
Dear Lustre-devel, 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? Thanks, John -- John L. Hammond TACC, The University of Texas at Austin jhammond at tacc.utexas.edu
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.
John Hammond
2011-Aug-01 16:10 UTC
[Lustre-devel] open(), getattr(), and negative dentries
On 07/27/2011 12:02 AM, Oleg Drokin wrote:> 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.Thanks, that''s helpful. I assume that "sufficiently long ago" means after ns_ctime_age_limit (10 by default) seconds have passed. I adjusted my test case to account for this but there still seems to be an issue here, so I created LU-560. Best, John -- John L. Hammond, Ph.D. TACC, The University of Texas at Austin jhammond at tacc.utexas.edu (512) 471-9304