mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-07-04 00:03:25 -04:00
UBIFS: fix debugfs-less systems support
Commit "f70b7e5
UBIFS: remove Kconfig debugging option" broke UBIFS and it
refuses to initialize if debugfs (CONFIG_DEBUG_FS) is disabled. I incorrectly
assumed that debugfs files creation function will return success if debugfs
is disabled, but they actually return -ENODEV. This patch fixes the issue.
Reported-by: Paul Parsons <lost.distance@yahoo.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Tested-by: Paul Parsons <lost.distance@yahoo.com>
This commit is contained in:
parent
e9b4cf2094
commit
818039c7d5
1 changed files with 10 additions and 2 deletions
|
@ -2918,6 +2918,9 @@ int dbg_debugfs_init_fs(struct ubifs_info *c)
|
||||||
struct dentry *dent;
|
struct dentry *dent;
|
||||||
struct ubifs_debug_info *d = c->dbg;
|
struct ubifs_debug_info *d = c->dbg;
|
||||||
|
|
||||||
|
if (!IS_ENABLED(DEBUG_FS))
|
||||||
|
return 0;
|
||||||
|
|
||||||
n = snprintf(d->dfs_dir_name, UBIFS_DFS_DIR_LEN + 1, UBIFS_DFS_DIR_NAME,
|
n = snprintf(d->dfs_dir_name, UBIFS_DFS_DIR_LEN + 1, UBIFS_DFS_DIR_NAME,
|
||||||
c->vi.ubi_num, c->vi.vol_id);
|
c->vi.ubi_num, c->vi.vol_id);
|
||||||
if (n == UBIFS_DFS_DIR_LEN) {
|
if (n == UBIFS_DFS_DIR_LEN) {
|
||||||
|
@ -3010,6 +3013,7 @@ out:
|
||||||
*/
|
*/
|
||||||
void dbg_debugfs_exit_fs(struct ubifs_info *c)
|
void dbg_debugfs_exit_fs(struct ubifs_info *c)
|
||||||
{
|
{
|
||||||
|
if (IS_ENABLED(DEBUG_FS))
|
||||||
debugfs_remove_recursive(c->dbg->dfs_dir);
|
debugfs_remove_recursive(c->dbg->dfs_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3095,6 +3099,9 @@ int dbg_debugfs_init(void)
|
||||||
const char *fname;
|
const char *fname;
|
||||||
struct dentry *dent;
|
struct dentry *dent;
|
||||||
|
|
||||||
|
if (!IS_ENABLED(DEBUG_FS))
|
||||||
|
return 0;
|
||||||
|
|
||||||
fname = "ubifs";
|
fname = "ubifs";
|
||||||
dent = debugfs_create_dir(fname, NULL);
|
dent = debugfs_create_dir(fname, NULL);
|
||||||
if (IS_ERR_OR_NULL(dent))
|
if (IS_ERR_OR_NULL(dent))
|
||||||
|
@ -3159,6 +3166,7 @@ out:
|
||||||
*/
|
*/
|
||||||
void dbg_debugfs_exit(void)
|
void dbg_debugfs_exit(void)
|
||||||
{
|
{
|
||||||
|
if (IS_ENABLED(DEBUG_FS))
|
||||||
debugfs_remove_recursive(dfs_rootdir);
|
debugfs_remove_recursive(dfs_rootdir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue