Roland McGrath <[EMAIL PROTECTED]> writes: > 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?
It is assumed that (with the exception of "..", and links to self) the structure of links is a DAG. The rule that you must hold a lock on the directory to acquire the node in the directory is very old in Unix, and works around the following situation: lock dir look up name, record inode number N unlock dir other thread now unlinks inode N, which then gets allocated as some new node lock inode N whoops--wrong node! (There is also a problem if the node is freed but not allocated; this problem is more easily detectable and can be worked around.) The ".." case works by: lock subdir look up .., record parent inode number N unlock subdir -- holding a reference to prevent reallocation lock parent inode N lock subdir look up ".." again, make sure it still points at N unlock subdir Thomas _______________________________________________ Bug-hurd mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-hurd