On 07/25, Oleg Nesterov wrote: > > To simplify the review, this is how it looks with the patch applied:
v2. We can use simply use list_for_each_entry_safe() and list_next_entry() should be calles under ->i_mutex. Although debugfs_remove_recursive() can race with itself anyway, but still. And the code looks much simpler. But I do not know what did I miss. 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; /* XXX: simple_empty(child) instead ? */ if (!list_empty(&child->d_subdirs)) { mutex_unlock(&parent->d_inode->i_mutex); parent = child; goto down; } up: __debugfs_remove(child, parent); } mutex_unlock(&parent->d_inode->i_mutex); if (parent != dentry) { child = parent; parent = parent->d_parent; mutex_lock(&parent->d_inode->i_mutex); next = list_next_entry(child, d_u.d_child); goto up; } parent = dentry->d_parent; mutex_lock(&parent->d_inode->i_mutex); __debugfs_remove(dentry, parent); mutex_unlock(&parent->d_inode->i_mutex); simple_release_fs(&debugfs_mount, &debugfs_mount_count); } -- 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/