linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Jones <davej@redhat.com>
To: Linus Torvalds <torvalds@linux-foundation.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: VFS deadlock ?
Date: Thu, 21 Mar 2013 18:29:15 -0400	[thread overview]
Message-ID: <20130321222915.GA2756@redhat.com> (raw)
In-Reply-To: <20130321221256.GA30620@redhat.com>

On Thu, Mar 21, 2013 at 06:12:56PM -0400, Dave Jones wrote:
 > On Thu, Mar 21, 2013 at 02:18:15PM -0700, Linus Torvalds wrote:
 >  > On Thu, Mar 21, 2013 at 2:02 PM, Dave Jones <davej@redhat.com> wrote:
 >  > >
 >  > > here we go...
 >  > >
 >  > > WARNING: at fs/namei.c:2335 lock_rename+0x156/0x160()
 >  > > p1=irda p2=irda
 >  > 
 >  > Ok, good. I ssupect it's /proc or /sys, we do have that entry there.
 >  > 
 >  > But in fact I suspect we do want the parent name after all, because I
 >  > think we have multiple "irda" directories. There's the one in
 >  > /proc/net/ (added by net/irda/irproc.c), and there's a sysctl  CTL_DIR
 >  > "irda" directory (kernel/sysctl_binary.c). And there might even be a
 >  > few other ones in /sys too, thanks to the ldisc called "irda" etc.
 >  > 
 >  > I don't see where the shared inode comes from, but I suspect that
 >  > would be easier to guess if we actually see which particular case it
 >  > ends up being..
 > 
 > it's not just irda fwiw..
 > 
 > p1=rpc p2=rpc p1parent=net p2parent=net
 > 
 > not sure why the printk with Al's last debugging info didn't print out..
 > Investigating..

missing \n meant it didn't go over serial..
on screen however was..

path1: path2: proc 0 0

sanity check ?

 
diff --git a/fs/namei.c b/fs/namei.c
index 57ae9c8..5afffe1 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2282,6 +2332,26 @@ struct dentry *lock_rename(struct dentry *p1, struct dentry *p2)
 		return NULL;
 	}
 
+	if (WARN_ON_ONCE(p1->d_inode == p2->d_inode)) {
+		static char path1[4096];
+		static char path2[4096];
+
+		printk(KERN_ERR "p1=%s p2=%s p1parent=%s p2parent=%s\n", p1->d_name.name, p2->d_name.name,
+				p1->d_parent->d_name.name,
+				p2->d_parent->d_name.name);
+
+		dentry_path(p1, path1, 4096);
+		dentry_path(p2, path2, 4096);
+
+		printk(KERN_ERR "path1:%s path2:%s %s %d %d\n",
+	                path1, path2, p1->d_sb->s_type->name, d_unlinked(p1), d_unlinked(p2));
+
+
+		mutex_lock_nested(&p1->d_inode->i_mutex, I_MUTEX_PARENT);
+		return NULL;
+	}
+
+
 	mutex_lock(&p1->d_inode->i_sb->s_vfs_rename_mutex);
 
 	p = d_ancestor(p2, p1);

@@ -2306,7 +2376,8 @@ struct dentry *lock_rename(struct dentry *p1, struct dentry *p2)
 void unlock_rename(struct dentry *p1, struct dentry *p2)
 {
 	mutex_unlock(&p1->d_inode->i_mutex);
-	if (p1 != p2) {
+
+	if (p1->d_inode != p2->d_inode) {
 		mutex_unlock(&p2->d_inode->i_mutex);
 		mutex_unlock(&p1->d_inode->i_sb->s_vfs_rename_mutex);
 	}


  reply	other threads:[~2013-03-21 22:29 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-21 19:06 VFS deadlock ? Dave Jones
2013-03-21 19:21 ` Al Viro
2013-03-21 20:31   ` Dave Jones
2013-03-21 19:29 ` Al Viro
2013-03-21 20:15   ` Linus Torvalds
2013-03-21 20:26     ` Dave Jones
2013-03-21 20:32       ` Linus Torvalds
2013-03-21 20:36         ` Dave Jones
2013-03-21 20:47           ` Al Viro
2013-03-21 21:02             ` Dave Jones
2013-03-21 21:18               ` Linus Torvalds
2013-03-21 21:26                 ` Al Viro
2013-03-21 21:41                   ` Dave Jones
2013-03-21 21:47                     ` Linus Torvalds
2013-03-21 21:55                       ` Al Viro
2013-03-21 21:57                         ` Linus Torvalds
2013-03-21 22:03                           ` Al Viro
2013-03-21 21:52                     ` Al Viro
2013-03-21 22:12                 ` Dave Jones
2013-03-21 22:29                   ` Dave Jones [this message]
2013-03-21 22:53                   ` Linus Torvalds
2013-03-21 23:07                     ` Dave Jones
2013-03-21 23:36                     ` Al Viro
2013-03-21 23:58                       ` Linus Torvalds
2013-03-22  0:01                         ` Linus Torvalds
2013-03-22  0:12                           ` Al Viro
2013-03-22  0:20                             ` Al Viro
2013-03-22  0:22                             ` Linus Torvalds
2013-03-22  1:22                               ` Al Viro
2013-03-22  1:33                                 ` Linus Torvalds
2013-03-22  1:40                                   ` Al Viro
2013-03-22  4:37                                     ` [CFT] " Al Viro
2013-03-22  4:55                                       ` Linus Torvalds
2013-03-22  5:18                                         ` Al Viro
2013-03-22  5:33                                           ` Linus Torvalds
2013-03-22  6:09                                             ` Al Viro
2013-03-22  6:22                                               ` Al Viro
2013-03-22 16:23                                             ` Dave Jones
2013-03-22 19:43                                             ` Linus Torvalds
2013-03-22 21:28                                               ` Al Viro
2013-03-22 22:57                                               ` Eric W. Biederman
2013-03-22  5:19                                         ` Linus Torvalds
2013-03-22  0:08                         ` Al Viro
2013-03-22  0:15                           ` Linus Torvalds
2013-03-22  0:19                             ` Linus Torvalds

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=20130321222915.GA2756@redhat.com \
    --to=davej@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --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;
as well as URLs for NNTP newsgroup(s).