Hunting down a refcount issue in an out-of-tree filesystem uncovered that its lookup function directly returned the dentry which was passed to it. Add a BUG_ON() to detect such misuse in future. Signed-off-by: Richard Weinberger <richard@xxxxxx> --- fs/namei.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/namei.c b/fs/namei.c index bc35b02..f8ccae6 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -1370,6 +1370,7 @@ static struct dentry *lookup_real(struct inode *dir, struct dentry *dentry, old = dir->i_op->lookup(dir, dentry, flags); if (unlikely(old)) { + BUG_ON(old == dentry); dput(dentry); dentry = old; } -- 2.2.2 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html