|
@@ -202,6 +202,7 @@ static void blk_remove_tree(struct dentry *dir)
|
|
|
static struct dentry *blk_create_tree(const char *blk_name)
|
|
|
{
|
|
|
struct dentry *dir = NULL;
|
|
|
+ int created = 0;
|
|
|
|
|
|
mutex_lock(&blk_tree_mutex);
|
|
|
|
|
@@ -209,13 +210,17 @@ static struct dentry *blk_create_tree(const char *blk_name)
|
|
|
blk_tree_root = debugfs_create_dir("block", NULL);
|
|
|
if (!blk_tree_root)
|
|
|
goto err;
|
|
|
+ created = 1;
|
|
|
}
|
|
|
|
|
|
dir = debugfs_create_dir(blk_name, blk_tree_root);
|
|
|
if (dir)
|
|
|
root_users++;
|
|
|
- else
|
|
|
- blk_remove_root();
|
|
|
+ else {
|
|
|
+ /* Delete root only if we created it */
|
|
|
+ if (created)
|
|
|
+ blk_remove_root();
|
|
|
+ }
|
|
|
|
|
|
err:
|
|
|
mutex_unlock(&blk_tree_mutex);
|