Ok, I was missing your point before, but I get it now -- if we were to put the new getattr in before the rmdirent, there is a possibility that someone could remove the last entry in the directory after the getattr but before the rmdirent could happen.

It's not a race though. A race has to have unexpected results based on relative timing. In our case, the situation you describe is indistinguishable from the case where the final removal occurs just as the rmdir returns, which is fine.

This new scheme does still leave open the possibility that we remove a directory's dirent when there is something in the directory (and then we recreate the dirent). We're just reducing the opportunities for this being seen.

It is also not the case that vtags would help here, because the directory's dirent (which is what we remove first) is not part of the directory itself (which is what we'd have the vtag for). I'm batting like 100 or so tonight, so I think I'll quit writing emails after this one and go to sleep or something.

Rob

Rob Ross wrote:


Sam Lang wrote:

The race that's an issue seems to be if the getattr tells me the directory is not empty, in which case I just return ENOTEMPTY back to the caller, but in the meantime someone else could have removed all the entries (in which case the remove should have succeeded). I'm not sure that's much of an issue for our users though.

That's not a race. First thing that happens on a file removal is that the directory entry is removed, so if something is being removed, it won't be in the directory.

Right now our caching scheme is under-the-covers so to speak, where we always continue with the operation if the cache misses. It seems like we could make a decision based on a cache hit. In other words, if I know the name and attribute are cached, I can save time by checking if the directory is not empty. If its not cached, I can just go down the rmdirent path like we do now. Doing lookup/getattr will add an extra roundtrip in most cases (where the directory is empty) if things aren't being cached. Overkill?

I don't like caching negative entries without consistency, so I like the idea of going down the path if we don't have any directory contents cached.

Rob
_______________________________________________
PVFS2-developers mailing list
[email protected]
http://www.beowulf-underground.org/mailman/listinfo/pvfs2-developers

_______________________________________________
PVFS2-developers mailing list
[email protected]
http://www.beowulf-underground.org/mailman/listinfo/pvfs2-developers

Reply via email to