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 <da...@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);
        }

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to