Hi! In libnetfs, the netfs_nref, netfs_nput, etc. functions use a global spin lock that they acquire before changing the reference count of a node. First of all, it is not clear to me why the lock needs to be global. Secondly, I have a race condition in tarfs which I believe could be avoided if the lock was a mutex.
Consider the following case which is what happens when using "rm". On the client side (rm), the program takes the following steps when typing "rm x": 1. lookup "." 2. lookup "x" 3. close x (ie. mach_port_deallocate () the above port) 4. unlink "x". On the server side, the successful lookup of "x" adds a reference to the corresponding node which is then dropped when the client closes it. However, when my netfs_attempt_unlink () is called and has locked the refcnt spin lock, it turns out that the reference has not been dropped yet. Since the number of references to the node is greater than 1, it will just return EBUSY. If the above scenario is correct, using a mutex for the refcnt count should remove the problem since it would enforce the order in which reference counts are changed (ie. the ref count would be decreased *before* attempt_unlink () checks its value). Comments? Ludovic. _______________________________________________ Help-hurd mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/help-hurd
