[PVFS2-developers] Removing of a directory

Phil Carns pcarns at wastedcycles.org
Tue Dec 20 15:06:23 EST 2005


Rob Ross wrote:
> I don't consider rmdirent to be a case that we need to highly optimize, 
> so if it helps to lookup the name and do the getattr beforehand, that's 
> cool by me.  I'm sure somewhere out there there is a rmdir test that 
> we'll do a little worse on, but whatever.
> 
> You'll still have to getattr again after the rmdirent to make sure that 
> the directory is still empty though, in case someone sneaks in between 
> the first getattr and the rmdirent and creates something.

The second getattr may not be required.  The server state machine that 
removes the directory also checks to see if it is empty before it does 
anything.  At that point (since the entry has already been removed) it 
probably doesn't matter whether the client detects the race via an error 
code from the remove request or by checking a fresh getattr.  The 
recovery steps should be the same, and the attempted remove operation 
doesn't have any extra cost.

-Phil



More information about the PVFS2-developers mailing list