warning patch for 2.1.120 msdos fs

Bill Hawes (whawes@star.net)
Fri, 11 Sep 1998 00:27:50 -0400


This is a multi-part message in MIME format.
--------------E8E3D50FBE4809ED49977C90
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

The attached patch detects and warns of a potentially serious problem in
msdos fs. It checks the dentry d_count when the dentry's inode is being
changed and warns if there are multiple users. (If another process has a
cached reference to the inode, the inode switch could cause big
trouble.)

I'm planning to fix this by checking for a busy dentry earlier, then
unhashing and rehashing to keep it from being found across a blocking
point. But until then, it's better to at least warn of the problem ...

Regards,
Bill
--------------E8E3D50FBE4809ED49977C90
Content-Type: text/plain; charset=us-ascii; name="msdos_120-patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="msdos_120-patch"

--- linux-2.1.120/fs/msdos/namei.c.old Sat Jan 24 10:13:16 1998
+++ linux-2.1.120/fs/msdos/namei.c Mon Sep 7 19:43:45 1998
@@ -747,8 +747,14 @@
MSDOS_I(free_inode)->i_logstart = MSDOS_I(old_inode)->i_logstart;
MSDOS_I(free_inode)->i_attrs = MSDOS_I(old_inode)->i_attrs;

- /* Detach d_alias from old inode and attach to new inode */
+ /*
+ * Detach d_alias from old inode and attach to new inode
+ * N.B. This isn't safe if the dentry is busy!
+ */
+ if (old_dentry->d_count > 1)
+ printk(KERN_WARNING "MSDOS: dentry busy when inode changed!\n");
list_del(&old_dentry->d_alias);
+ INIT_LIST_HEAD(&old_dentry->d_alias);
d_instantiate(old_dentry, free_inode);
iput(old_inode);

--------------E8E3D50FBE4809ED49977C90--

-
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/faq.html