[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130726151151.GA19472@redhat.com>
Date: Fri, 26 Jul 2013 17:11:51 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Steven Rostedt <rostedt@...dmis.org>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Al Viro <viro@...iv.linux.org.uk>,
Alexander Z Lam <azl@...gle.com>,
Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
David Sharp <dhsharp@...gle.com>,
Frederic Weisbecker <fweisbec@...il.com>,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Srikar Dronamraju <srikar@...ux.vnet.ibm.com>,
Vaibhav Nagarnaik <vnagarnaik@...gle.com>,
"zhangwei(Jovi)" <jovi.zhangwei@...wei.com>,
linux-kernel@...r.kernel.org
Subject: [PATCH 0/1] debugfs: debugfs_remove_recursive() must not rely on
list_empty(d_subdirs)
On 07/25, Greg Kroah-Hartman wrote:
>
> Anyway, your changes below look good in this version, I don't see
> anything obviously wrong with it, but maybe others do?
Please see 1/1.
Changes:
- s/list_next_entry/list_entry/. It would be nice to move
list_next_entry() from kernel/events/core.c to list.h
but this needs another patch
- Do "parent = parent->d_parent" before "!= dentry" check,
this factors out the common code in "goto up" and final
__debugfs_remove(dentry)
- Add simple_release_fs() back.
The patch is hardly readable, so I attached the code below again.
Note!!! The changelog contains the simple test-case. However, this
test-case can actually reveal more problems because kernel/trace/
is buggy too. (hopefully we already have the necessary fixes).
Steven, Greg. Assuming that nobody objects and the patch is fine.
Perhaps this patch can be routed via rostedt/linux-trace tree?
This connects to other problems we are working on, it would be
nice to have this patch in the same tree to simplify the testing.
Oleg.
void debugfs_remove_recursive(struct dentry *dentry)
{
struct dentry *child, *next, *parent;
if (IS_ERR_OR_NULL(dentry))
return;
parent = dentry->d_parent;
if (!parent || !parent->d_inode)
return;
parent = dentry;
down:
mutex_lock(&parent->d_inode->i_mutex);
list_for_each_entry_safe(child, next, &parent->d_subdirs, d_u.d_child) {
if (!debugfs_positive(child))
continue;
/* perhaps simple_empty(child) makes more sense */
if (!list_empty(&child->d_subdirs)) {
mutex_unlock(&parent->d_inode->i_mutex);
parent = child;
goto down;
}
up:
if (!__debugfs_remove(child, parent))
simple_release_fs(&debugfs_mount, &debugfs_mount_count);
}
mutex_unlock(&parent->d_inode->i_mutex);
child = parent;
parent = parent->d_parent;
mutex_lock(&parent->d_inode->i_mutex);
if (child != dentry) {
next = list_entry(child->d_u.d_child.next, struct dentry,
d_u.d_child);
goto up;
}
if (!__debugfs_remove(child, parent))
simple_release_fs(&debugfs_mount, &debugfs_mount_count);
mutex_unlock(&parent->d_inode->i_mutex);
}
--
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