On Fri, Oct 19, 2012 at 02:07:23AM +0000, Taylor R Campbell wrote: > Module Name: src > Committed By: riastradh > Date: Fri Oct 19 02:07:23 UTC 2012 > > Modified Files: > src/sys/kern: vfs_syscalls.c > > Log Message: > No, we can't elide the fs-wide rename lock for same-directory rename. > > rename("a/b", "a/c") and rename("a/c/x", "a/b/y") will deadlock.
Surely it just converts rename("a/c/x", "a/b/y") into rename("a/c/x", "a/c/y") which isn't quite the intended operation. Maybe convert the fs-wide rename lock into a rw-lock and only require read access for a same-directory rename. That might only be useful in the common case where the two directory paths are the same actual character - when only one VOP_LOOKUP() is needed at all and the child inodes don't even need looking at. I suspect the DNLC (and any other caches) will need both rename ops done atomically though. David -- David Laight: da...@l8s.co.uk