[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFyE12rZ3DZUtTkonPjbcQiZNdAmys7w5zf7_Xry2z=-2A@mail.gmail.com>
Date: Fri, 8 Mar 2013 11:47:54 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Dave Jones <davej@...hat.com>,
Linux Kernel <linux-kernel@...r.kernel.org>,
Al Viro <viro@...iv.linux.org.uk>
Subject: Re: BUG_ON(nd->inode != parent->d_inode);
On Fri, Mar 8, 2013 at 11:36 AM, Dave Jones <davej@...hat.com> wrote:
>
> I changed it to do this..
>
> diff --git a/fs/namei.c b/fs/namei.c
> index 961bc12..c1ca29e 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -689,8 +689,6 @@ void nd_jump_link(struct nameidata *nd, struct path *path)
> nd->path = *path;
> nd->inode = nd->path.dentry->d_inode;
> nd->flags |= LOOKUP_JUMPED;
> -
> - BUG_ON(nd->inode->i_op->follow_link);
> }
>
> static inline void put_link(struct nameidata *nd, struct path *link, void *cookie)
> @@ -1438,7 +1436,13 @@ static int lookup_slow(struct nameidata *nd, struct path *path)
> int err;
>
> parent = nd->path.dentry;
> - BUG_ON(nd->inode != parent->d_inode);
> +
> + if (WARN_ON(nd->inode != parent->d_inode)) {
> + printk("%s -> %p (%s)\n", parent->d_name.name, path->dentry, nd->last.name);
> + return -EINVAL;
> + }
Ok, it might be nice to print out the path dentry name if it has one,
but it may well be that this only happens with negative dentries in
proc or sysfs, since you said that you just added testing of that..
> And now I'm getting a different BUG_ON
Heh. It's the same BUG_ON(), it's just replicated (and "parent" is
called "dir" here).
Maybe you can make the WARN_ON_ONCE() version be a macro, because that
test exists in multiple places: unlazy_walk, complete_walk,
lookup_slow and do_last (and walk_component in a different guise).
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists