From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Subject: Re: PROBLEM: Corrupting d_count of target dentry, when rename directory to the directory which is mount point, or when rename directory which is mount point to the existing directory. Date: Sat, 4 Jun 2011 00:11:58 +0100 Message-ID: <20110603231158.GR11521@ZenIV.linux.org.uk> References: <254871306829495@web62.yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org To: Dmitry Dmitriev Return-path: Content-Disposition: inline In-Reply-To: <254871306829495@web62.yandex.ru> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org > 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...