Skip to contentSkip to conversation

ubi debugfs possible regression

PATCH In review Paul Parsons 2 participants 7 messages Jun 6, 2012 – Jun 7, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

In v3.4, ubi worked OK without debugfs.

In v3.5-rc1, ubi fails without debugfs:

UBI error: ubi_debugfs_init: cannot create "ubi" debugfs directory, error -19 UBI error: ubi_init: UBI error: cannot initialize UBI, error -19

Is this not a regression?

#1 lore raw
Quoted 8 lines · Paul Parsons

In v3.4, ubi worked OK without debugfs.

In v3.5-rc1, ubi fails without debugfs:

UBI error: ubi_debugfs_init: cannot create "ubi" debugfs directory, error -19 UBI error: ubi_init: UBI error: cannot initialize UBI, error -19

Is this not a regression?

It is, I'll look at this.

Signature · 2 lines
Best Regards,
Artem Bityutskiy
#2 lore raw
Quoted 11 lines · Artem Bityutskiy
Quoted 8 lines · Paul Parsons

In v3.4, ubi worked OK without debugfs.

In v3.5-rc1, ubi fails without debugfs:

UBI error: ubi_debugfs_init: cannot create "ubi" debugfs directory, error -19 UBI error: ubi_init: UBI error: cannot initialize UBI, error -19

Is this not a regression?

It is, I'll look at this.

Can you please send me your .config file - I cannot easily disable debugfs - it is enabled/required by so many things.

Signature · 2 lines
Best Regards,
Artem Bityutskiy
#3 lore raw

PATCH 1/2 UBI: fix debugfs-less systems support

In reply to Paul Parsons

From: Artem Bityutskiy <[email protected]>

Commit "aa44d1d UBI: remove Kconfig debugging option" broke UBI 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.

---
 drivers/mtd/ubi/debug.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
drivers/mtd/ubi/debug.c +10 -2
index 9f957c2..09d4f8d 100644
@@ -264,6 +264,9 @@ static struct dentry *dfs_rootdir;
  */
 int ubi_debugfs_init(void)
 {
+	if (!IS_ENABLED(DEBUG_FS))
+		return 0;
+
 	dfs_rootdir = debugfs_create_dir("ubi", NULL);
 	if (IS_ERR_OR_NULL(dfs_rootdir)) {
 		int err = dfs_rootdir ? -ENODEV : PTR_ERR(dfs_rootdir);
@@ -281,7 +284,8 @@ int ubi_debugfs_init(void)
  */
 void ubi_debugfs_exit(void)
 {
-	debugfs_remove(dfs_rootdir);
+	if (IS_ENABLED(DEBUG_FS))
+		debugfs_remove(dfs_rootdir);
 }
 
 /* Read an UBI debugfs file */
@@ -403,6 +407,9 @@ int ubi_debugfs_init_dev(struct ubi_device *ubi)
 	struct dentry *dent;
 	struct ubi_debug_info *d = ubi->dbg;
 
+	if (!IS_ENABLED(DEBUG_FS))
+		return 0;
+
 	n = snprintf(d->dfs_dir_name, UBI_DFS_DIR_LEN + 1, UBI_DFS_DIR_NAME,
 		     ubi->ubi_num);
 	if (n == UBI_DFS_DIR_LEN) {
@@ -470,5 +477,6 @@ out:
  */
 void ubi_debugfs_exit_dev(struct ubi_device *ubi)
 {
-	debugfs_remove_recursive(ubi->dbg->dfs_dir);
+	if (IS_ENABLED(DEBUG_FS))
+		debugfs_remove_recursive(ubi->dbg->dfs_dir);
 }
Signature · 1 line
1.7.7.6
#4 lore raw

PATCH 2/2 UBIFS: fix debugfs-less systems support

From: Artem Bityutskiy <[email protected]>

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.

---
 fs/ubifs/debug.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
fs/ubifs/debug.c +10 -2
index 685a837..84a7e6f 100644
@@ -2918,6 +2918,9 @@ int dbg_debugfs_init_fs(struct ubifs_info *c)
 	struct dentry *dent;
 	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,
 		     c->vi.ubi_num, c->vi.vol_id);
 	if (n == UBIFS_DFS_DIR_LEN) {
@@ -3010,7 +3013,8 @@ out:
  */
 void dbg_debugfs_exit_fs(struct ubifs_info *c)
 {
-	debugfs_remove_recursive(c->dbg->dfs_dir);
+	if (IS_ENABLED(DEBUG_FS))
+		debugfs_remove_recursive(c->dbg->dfs_dir);
 }
 
 struct ubifs_global_debug_info ubifs_dbg;
@@ -3095,6 +3099,9 @@ int dbg_debugfs_init(void)
 	const char *fname;
 	struct dentry *dent;
 
+	if (!IS_ENABLED(DEBUG_FS))
+		return 0;
+
 	fname = "ubifs";
 	dent = debugfs_create_dir(fname, NULL);
 	if (IS_ERR_OR_NULL(dent))
@@ -3159,7 +3166,8 @@ out:
  */
 void dbg_debugfs_exit(void)
 {
-	debugfs_remove_recursive(dfs_rootdir);
+	if (IS_ENABLED(DEBUG_FS))
+		debugfs_remove_recursive(dfs_rootdir);
 }
 
 /**
Signature · 1 line
1.7.7.6
author Tested-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] UBIFS: fix debugfs-less systems support

Quoted 10 lines · Artem Bityutskiy

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.

Thanks Artem!

This patch series works for me on linux-3.5.0-rc1.