Re: PROBLEM: Corrupting d_count of target dentry, when renamedirectory to the directory which is mount point, or when rename directorywhich is mount point to the existing directory.

From: Al Viro
Date: Fri Jun 03 2011 - 19:12:10 EST


> When new_dentry exist, i.e. 'target' is not NULL, and a mount point( or old dentry is a mount point ), then function set 'error' variable to -EBUSY( line 2581 ). After that function will call dput function for new_dentry( line 2595 ) without corresponding dget. In this case d_count of dentry become corrupted. In case when old dentry and new dentry are not mount points, dget for new dentry is called in dentry_unhash function.

What do you mean, without corresponding dget()? It's done in dentry_unhash().

Oh, hell... We don't call it in that case. Right. vfs_rmdir() used to
do dentry_unhash() before the checks for mountpoints, vfs_rename_other() -
only after.

The funny part is, it got accidentally fixed in this merge window. -stable
still needs fixing - by moving dentry_unhash() down past the checks for
d_mountpoint(). Mainline should be OK now...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/