It seems reasonable to me to leave it up to the filesystem-specific code to
decide what nodes it might need to lock, and just give it enough
information to avoid deadlock.  I have in my tree a slightly different
change that adds a struct node * argument to diskfs_cached_lookup instead
of a flag, indicating the directory node (or none if null) that the caller
has locked.  I think that by using this the special case for ".." in
libdiskfs/name-cache.c can be removed.  I have changes that add the
argument, remove the ".." special case for unlocking in
diskfs_check_lookup_cache, and instead makes each diskfs_cached_lookup
implementation check for the lookup matching the already-locked node.

It occurs to me that without this change, if a directory in a ufs or ext2fs
filesystem contains a link to itself by a name other than "..", then a
lookup of that name will deadlock the directory node.  (That is probably an
invalid state that fsck would fix, but still.)  Am I right about that?

I'll put these changes in if Thomas agrees it makes sense.

_______________________________________________
Bug-hurd mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-hurd

Reply via email to