Messages in this thread | | | Date | Sat, 6 Feb 1999 22:07:41 -0500 (EST) | From | Alexander Viro <> | Subject | Re: Linux-2.2.2-pre2.. |
| |
On Sat, 6 Feb 1999, Linus Torvalds wrote:
> Ahh, thanks. I was convinced for some reason that this couldn't happen > because we held the parent semaphore, but you're obviously right: even > though we hold the parent semaphore it only means that the directory > itself cannot be looked up, but somebody who already has the directory > looked up (in cwd or similar) wouldn't need to care.
Erm... Linus, if you assume that semaphore on the path to hashed dentry may stop anybody from getting it you may want to look into cached_lookup(). It doesn't touch semaphores at all. So even if semaphores are hold on /, /foo and /foo/bar lookup on "/foo/bar/baz" will go through if /foo/bar/baz is already in dcache.
> Anyway, the patch looks correct, although I have to admit that it starts > to smell like this should all be done in common code at the VFS layer > rather than each filesystem having to know about this fairly subtle race. > I designed the VFS locking exactly in such a way that the filesystems > themselves wouldn't have to care about the directory tree consistency > issues. D'oh. Now, if it would be the only bad thing about rename()... In essence, we have it serialized by a per-fs lock. It's done in each fs separately. And it prevents us from moving other generic tests to VFS, where they belong. I'ld be more than happy to have this puppet moved to vfs_rename(), along with is_subdir() stuff and check for source and target having the same inode. Then foo_rename()s would start to look sane. But it requires adding new fields to struct super (lock and wait queue) [1]. If you'll give clearance I'll do it ASAP.
> Would you mind looking into something like that? I'd be grateful,
Heh. I would be more than grateful if you'll allow me to do that. rename() is *the* ugliest namespace-related method. Having all generic tests in VFS would make life much easier when we'll go for making VFS SMP-safe. BTW, the less parts of VFS are scattered over all fs drivers the more inpenedent all filesystems become. I.e. less pain in ass for folks maintaining AFS, ARLA, DMSDOS, r/w HPFS, etc. Cheers, Al [1] ... expecting to see black helicopters sent by Derek RSN[2]. [2] BTW, life would be *much* easier if we'ld keep fs-specific parts of inode and super allocated separately. I did it for ext2 and it seems to work fine. If it would be done for all filesystems the memory usage would decrease for almost everybody.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |