From: Andrew Morton <akpm@osdl.org>
To: Arjan van de Ven <arjan@linux.intel.com>
Cc: mingo@elte.hu, reiserfs-list@namesys.com,
reiserfs-dev@namesys.com, viro@ftp.linux.org.uk,
viro@zeniv.linux.org.uk, reiser@namesys.com,
linux-kernel@vger.kernel.org, jesper.juhl@gmail.com
Subject: Re: [patch] lockdep: annotate vfs_rmdir for filesystems that take i_mutex in delete_inode
Date: Wed, 26 Jul 2006 00:04:52 -0700 [thread overview]
Message-ID: <20060726000452.52179c32.akpm@osdl.org> (raw)
In-Reply-To: <1153896441.2896.11.camel@laptopd505.fenrus.org>
On Wed, 26 Jul 2006 08:47:21 +0200
Arjan van de Ven <arjan@linux.intel.com> wrote:
> On Tue, 2006-07-25 at 22:33 -0700, Andrew Morton wrote:
> > On Wed, 26 Jul 2006 00:16:42 +0200
> > The VFS takes the directory i_mutex and reiserfs_delete_inode() takes the
> > to-be-deleted file's i_mutex.
> >
> > That's notabug and lockdep will need to be taught about it.
>
> [2nd try, now with coffee]
>
> This is another 3 level locking ordering:
> do_rmdir takes the mutex of the parent directory
> vfs_rmdir takes the mutex of the victim
> shrink_dcache_parent ends up in the reiser delete_inode which takes the
> mutex of dead children of the victim
>
> the I_MUTEX ordering rules are
>
> I_MUTEX_PARENT -> I_MUTEX_CHILD -> <normal>
>
> do_rmdir already has I_MUTEX_PARENT, delete_inode does <normal> so
> vfs_rmdir needs I_MUTEX_CHILD (which is also logical)
>
> Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
>
> Index: linux-2.6.18-rc2-git5/fs/namei.c
> ===================================================================
> --- linux-2.6.18-rc2-git5.orig/fs/namei.c
> +++ linux-2.6.18-rc2-git5/fs/namei.c
> @@ -1967,7 +1967,7 @@ int vfs_rmdir(struct inode *dir, struct
>
> DQUOT_INIT(dir);
>
> - mutex_lock(&dentry->d_inode->i_mutex);
> + mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_CHILD);
> dentry_unhash(dentry);
> if (d_mountpoint(dentry))
> error = -EBUSY;
If there's a reason why a filesystem shuld take an i_mutex under
vfs_rmdir() then fine. But I don't think there is, in which case the
warning can be kept.
Can a reiserfs person please comment?
prev parent reply other threads:[~2006-07-26 7:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-25 22:16 possible recursive locking detected - while running fs operations in loops - 2.6.18-rc2-git5 Jesper Juhl
2006-07-25 23:29 ` Andreas Dilger
2006-07-29 22:18 ` Jesper Juhl
2006-07-29 23:08 ` Hans Reiser
2006-07-30 6:17 ` Jesper Juhl
2006-07-30 0:46 ` Hans Reiser
2006-07-30 10:08 ` Jesper Juhl
2006-07-31 19:34 ` Alexander Zarochentsev
2006-07-26 5:33 ` Andrew Morton
2006-07-26 6:32 ` [patch] lockdep: annotate vfs_rmdir for filesystems that take i_mutex in delete_inode Arjan van de Ven
2006-07-26 6:38 ` Arjan van de Ven
2006-07-26 6:47 ` Arjan van de Ven
2006-07-26 7:04 ` Andrew Morton [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060726000452.52179c32.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=arjan@linux.intel.com \
--cc=jesper.juhl@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=reiser@namesys.com \
--cc=reiserfs-dev@namesys.com \
--cc=reiserfs-list@namesys.com \
--cc=viro@ftp.linux.org.uk \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®