[FIX] rename over mount point fails

From: Stephen Rothwell (sfr@linuxcare.com)
Date: Thu Aug 10 2000 - 02:17:47 EST


Hi Linus,

A while ago, Chris Yeoh discovered while testing Posix
compliance that renaming a directory over another directory
that was in use as a mount point did very bad things[tm].

It looked like there was a loop in the d_hash list for the
directory we tried this trick in.

Here is a fix ... I do not understand the dcache well enough
to say if this is correct, but it does stop the kernel hanging.

--- 2.4.0-test6/fs/namei.c Thu Aug 10 14:07:01 2000
+++ 2.4.0-test6-fix/fs/namei.c Thu Aug 10 16:56:26 2000
@@ -1690,7 +1690,8 @@
                 triple_up(&old_dir->i_zombie,
                           &new_dir->i_zombie,
                           &target->i_zombie);
- d_rehash(new_dentry);
+ if (d_unhashed(new_dentry))
+ d_rehash(new_dentry);
                 dput(new_dentry);
         } else
                 double_up(&old_dir->i_zombie,

Cheers,
Stephen

-- 
Stephen Rothwell, Open Source Researcher, Linuxcare, Inc.
+61-2-62628990 tel, +61-2-62628991 fax 
sfr@linuxcare.com, http://www.linuxcare.com/ 
Linuxcare. Support for the revolution.

- 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/



This archive was generated by hypermail 2b29 : Tue Aug 15 2000 - 21:00:20 EST