IB/mlx5: Clean mr_cache debugfs in case of failure
The failure in creation of debugfs entries for mr_cache left entries, which were already created. It caused to mismatch and misguiding for the end users. The solution is to clean mr_cache debugfs root, so no leftovers will be in the system. In addition, let's document why the error is not needed to be forwarded to user in case of failure. Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Reviewed-by: Matan Barak <matanb@mellanox.com> Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
parent
7855f58427
commit
12cc1a0273
|
@ -582,6 +582,15 @@ static void clean_keys(struct mlx5_ib_dev *dev, int c)
|
|||
}
|
||||
}
|
||||
|
||||
static void mlx5_mr_cache_debugfs_cleanup(struct mlx5_ib_dev *dev)
|
||||
{
|
||||
if (!mlx5_debugfs_root)
|
||||
return;
|
||||
|
||||
debugfs_remove_recursive(dev->cache.root);
|
||||
dev->cache.root = NULL;
|
||||
}
|
||||
|
||||
static int mlx5_mr_cache_debugfs_init(struct mlx5_ib_dev *dev)
|
||||
{
|
||||
struct mlx5_mr_cache *cache = &dev->cache;
|
||||
|
@ -600,38 +609,34 @@ static int mlx5_mr_cache_debugfs_init(struct mlx5_ib_dev *dev)
|
|||
sprintf(ent->name, "%d", ent->order);
|
||||
ent->dir = debugfs_create_dir(ent->name, cache->root);
|
||||
if (!ent->dir)
|
||||
return -ENOMEM;
|
||||
goto err;
|
||||
|
||||
ent->fsize = debugfs_create_file("size", 0600, ent->dir, ent,
|
||||
&size_fops);
|
||||
if (!ent->fsize)
|
||||
return -ENOMEM;
|
||||
goto err;
|
||||
|
||||
ent->flimit = debugfs_create_file("limit", 0600, ent->dir, ent,
|
||||
&limit_fops);
|
||||
if (!ent->flimit)
|
||||
return -ENOMEM;
|
||||
goto err;
|
||||
|
||||
ent->fcur = debugfs_create_u32("cur", 0400, ent->dir,
|
||||
&ent->cur);
|
||||
if (!ent->fcur)
|
||||
return -ENOMEM;
|
||||
goto err;
|
||||
|
||||
ent->fmiss = debugfs_create_u32("miss", 0600, ent->dir,
|
||||
&ent->miss);
|
||||
if (!ent->fmiss)
|
||||
return -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
err:
|
||||
mlx5_mr_cache_debugfs_cleanup(dev);
|
||||
|
||||
static void mlx5_mr_cache_debugfs_cleanup(struct mlx5_ib_dev *dev)
|
||||
{
|
||||
if (!mlx5_debugfs_root)
|
||||
return;
|
||||
|
||||
debugfs_remove_recursive(dev->cache.root);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
static void delay_time_func(unsigned long ctx)
|
||||
|
@ -692,6 +697,11 @@ int mlx5_mr_cache_init(struct mlx5_ib_dev *dev)
|
|||
if (err)
|
||||
mlx5_ib_warn(dev, "cache debugfs failure\n");
|
||||
|
||||
/*
|
||||
* We don't want to fail driver if debugfs failed to initialize,
|
||||
* so we are not forwarding error to the user.
|
||||
*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue