Skip to contentSkip to conversation

open(), getattr(), and negative dentries

Lustre-devel John Hammond 2 participants 3 messages Jul 21, 2011 – Aug 1, 2011

lore
Share & tools
lore
#0 lore raw

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

Signature · 3 lines
John L. Hammond
TACC, The University of Texas at Austin
jhammond at tacc.utexas.edu
#1 lore raw

Hello!

Quoted 5 lines · John Hammond

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.

#2 lore raw
Quoted 10 lines · Oleg Drokin

Hello!

Quoted 5 lines · John Hammond

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?

Quoted 7 lines

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

Signature · 4 lines
John L. Hammond, Ph.D.
TACC, The University of Texas at Austin
jhammond at tacc.utexas.edu
(512) 471-9304