Skip to contentSkip to conversation

ubifs: silence error output if MS_SILENT is set

PATCH Superseded Daniel Golle 3 participants 8 messages Jun 18, 2016

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

PATCH 1/1 ubifs: silence error output if MS_SILENT is set

---
 fs/ubifs/super.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
fs/ubifs/super.c +3 -2
index 7034995..ae32b3c 100644
@@ -2108,8 +2108,9 @@ static struct dentry *ubifs_mount(struct file_system_type *fs_type, int flags,
 	 */
 	ubi = open_ubi(name, UBI_READONLY);
 	if (IS_ERR(ubi)) {
-		pr_err("UBIFS error (pid: %d): cannot open \"%s\", error %d",
-		       current->pid, name, (int)PTR_ERR(ubi));
+		if (flags & MS_SILENT)
+			pr_err("UBIFS error (pid: %d): cannot open \"%s\", error %d",
+			       current->pid, name, (int)PTR_ERR(ubi));
 		return ERR_CAST(ubi);
 	}
 
Signature · 1 line
2.8.3
#1 lore raw
Quoted 10 lines · Daniel Golle
---
 fs/ubifs/super.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
fs/ubifs/super.c +0 -0
index 7034995..ae32b3c 100644

fs/ubifs/super.c static struct dentry *ubifs_mount(struct file_system_type *fs_type, int flags, · line 2113

Quoted 8 lines
fs/ubifs/super.c +3 -2
@@ -2108,8 +2108,9 @@ static struct dentry *ubifs_mount(struct file_system_type *fs_type, int flags,
         */
        ubi = open_ubi(name, UBI_READONLY);
        if (IS_ERR(ubi)) {
-               pr_err("UBIFS error (pid: %d): cannot open \"%s\", error %d",
-                      current->pid, name, (int)PTR_ERR(ubi));
+               if (flags & MS_SILENT)
+                       pr_err("UBIFS error (pid: %d): cannot open \"%s\", error %d",
+                              current->pid, name, (int)PTR_ERR(ubi));

This needs a more detailed explanation.
Why does UBIFS need this? Only very few filesystems care about MS_SILENT. What problem are you trying to address?

Signature · 2 lines
Thanks,
//richard
#2 lore raw

Hi Richard,

first of all, thanks for reviewing my patch!

Quoted 6 lines · Richard Weinberger
Quoted 5 lines · Daniel Golle
---
 fs/ubifs/super.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Quoted 15 lines

fs/ubifs/super.c static struct dentry *ubifs_mount(struct file_system_type *fs_type, int flags, · line 2113

Quoted 13 lines
fs/ubifs/super.c +3 -2
index 7034995..ae32b3c 100644
@@ -2108,8 +2108,9 @@ static struct dentry *ubifs_mount(struct file_system_type *fs_type, int flags,
         */
        ubi = open_ubi(name, UBI_READONLY);
        if (IS_ERR(ubi)) {
-               pr_err("UBIFS error (pid: %d): cannot open \"%s\", error %d",
-                      current->pid, name, (int)PTR_ERR(ubi));
+               if (flags & MS_SILENT)
+                       pr_err("UBIFS error (pid: %d): cannot open \"%s\", error %d",
+                              current->pid, name, (int)PTR_ERR(ubi));

This needs a more detailed explanation.

Basically this should be seen in context of
commit 90bea5a3f0bf680b87b90516f3c231997f4b8f3b
which already implements support for MS_SILENT except for that one error message which is still being displayed despite MS_SILENT being set.

Quoted 1 line

Why does UBIFS need this? Only very few filesystems care about MS_SILENT.

Afaik all filesystems potentially used as rootfs on Linux do support MS_SILENT.

Quoted 1 line

What problem are you trying to address?

On OpenWrt / LEDE we are probing whether the UBI volume set to be rootfs contains a squashfs and thus a ubiblock device is being created and ROOT_DEV is set accordingly. Similarly, we are also probing whether the rootfs volume contains a ubifs (which is supported so people can use our kernel and e.g. Debian's userspace or to waste less space compared to overlay(lower=squashfs,upper=ubifs) when frequently updating or heavily modifying the rootfs during runtime). Thus, users get to see that error message in their kernel logs

[    3.060000] UBIFS error (pid: 1): cannot open "ubi0:rootfs", error -19

even though every thing is fine (rootfs just happends to not be ubifs) and that's misleading as people often blame the first error message they see to be the cause for anything not working.

Cheers

Daniel

#4 lore raw

PATCH v2 1/1 ubifs: silence error output if MS_SILENT is set

In reply to Daniel Golle

---
v2: logic was accidentally inverted, fix that.

 fs/ubifs/super.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
fs/ubifs/super.c +3 -2
index 7034995..736dd58 100644
@@ -2108,8 +2108,9 @@ static struct dentry *ubifs_mount(struct file_system_type *fs_type, int flags,
 	 */
 	ubi = open_ubi(name, UBI_READONLY);
 	if (IS_ERR(ubi)) {
-		pr_err("UBIFS error (pid: %d): cannot open \"%s\", error %d",
-		       current->pid, name, (int)PTR_ERR(ubi));
+		if (!(flags & MS_SILENT))
+			pr_err("UBIFS error (pid: %d): cannot open \"%s\", error %d",
+			       current->pid, name, (int)PTR_ERR(ubi));
 		return ERR_CAST(ubi);
 	}
 
Signature · 1 line
2.8.3
#3 lore raw
In reply to Daniel Golle

Hi!

Am 18.06.2016 um 15:42 schrieb Daniel Golle:

Quoted 27 lines

Hi Richard,

first of all, thanks for reviewing my patch!

Quoted 6 lines · Richard Weinberger
Quoted 5 lines · Daniel Golle
---
 fs/ubifs/super.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Quoted 15 lines

fs/ubifs/super.c static struct dentry *ubifs_mount(struct file_system_type *fs_type, int flags, · line 2113

Quoted 13 lines
fs/ubifs/super.c +3 -2
index 7034995..ae32b3c 100644
@@ -2108,8 +2108,9 @@ static struct dentry *ubifs_mount(struct file_system_type *fs_type, int flags,
         */
        ubi = open_ubi(name, UBI_READONLY);
        if (IS_ERR(ubi)) {
-               pr_err("UBIFS error (pid: %d): cannot open \"%s\", error %d",
-                      current->pid, name, (int)PTR_ERR(ubi));
+               if (flags & MS_SILENT)
+                       pr_err("UBIFS error (pid: %d): cannot open \"%s\", error %d",
+                              current->pid, name, (int)PTR_ERR(ubi));

This needs a more detailed explanation.

Quoted 5 lines

Basically this should be seen in context of
commit 90bea5a3f0bf680b87b90516f3c231997f4b8f3b
which already implements support for MS_SILENT except for that one error message which is still being displayed despite MS_SILENT being set.

This should be part of the commit message since it is a fixup for the said change.

Quoted 15 lines
Quoted 1 line

Why does UBIFS need this? Only very few filesystems care about MS_SILENT.

Afaik all filesystems potentially used as rootfs on Linux do support MS_SILENT.

Quoted 1 line

What problem are you trying to address?

On OpenWrt / LEDE we are probing whether the UBI volume set to be rootfs contains a squashfs and thus a ubiblock device is being created and ROOT_DEV is set accordingly. Similarly, we are also probing whether the rootfs volume contains a ubifs (which is supported so people can use our kernel and e.g. Debian's userspace or to waste less space compared to overlay(lower=squashfs,upper=ubifs) when frequently updating or heavily modifying the rootfs during runtime). Thus, users get to see that error message in their kernel logs

Quoted 4 lines
[    3.060000] UBIFS error (pid: 1): cannot open "ubi0:rootfs", error -19

even though every thing is fine (rootfs just happends to not be ubifs) and that's misleading as people often blame the first error message they see to be the cause for anything not working.

While your fix is fine I think you should do better than just trial&error probing. e.g. Identify the rootfs type from the volume label.

Thanks,
//richard

#6 lore raw

PATCH v3 1/1 ubifs: silence error output if MS_SILENT is set

This change completes
commit 90bea5a3f0bf680b87b90516f3c231997f4b8f3b
which already implements support for MS_SILENT except for that one error message which is still being displayed despite MS_SILENT being set. Suppress that error message as well in case MS_SILENT is set.

---
v2: logic was accidentally inverted, fix that.
v3: add patch description

 fs/ubifs/super.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
fs/ubifs/super.c +3 -2
index 7034995..736dd58 100644
@@ -2108,8 +2108,9 @@ static struct dentry *ubifs_mount(struct file_system_type *fs_type, int flags,
 	 */
 	ubi = open_ubi(name, UBI_READONLY);
 	if (IS_ERR(ubi)) {
-		pr_err("UBIFS error (pid: %d): cannot open \"%s\", error %d",
-		       current->pid, name, (int)PTR_ERR(ubi));
+		if (!(flags & MS_SILENT))
+			pr_err("UBIFS error (pid: %d): cannot open \"%s\", error %d",
+			       current->pid, name, (int)PTR_ERR(ubi));
 		return ERR_CAST(ubi);
 	}
 
Signature · 1 line
2.8.3
#7 lore raw

Am 18.06.2016 um 17:53 schrieb Daniel Golle:

Quoted 19 lines

This change completes
commit 90bea5a3f0bf680b87b90516f3c231997f4b8f3b
which already implements support for MS_SILENT except for that one error message which is still being displayed despite MS_SILENT being set. Suppress that error message as well in case MS_SILENT is set.

---
v2: logic was accidentally inverted, fix that.
v3: add patch description

 fs/ubifs/super.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
fs/ubifs/super.c +0 -0
index 7034995..736dd58 100644

fs/ubifs/super.c static struct dentry *ubifs_mount(struct file_system_type *fs_type, int flags, · line 2115

Quoted 10 lines
fs/ubifs/super.c +3 -2
@@ -2108,8 +2108,9 @@ static struct dentry *ubifs_mount(struct file_system_type *fs_type, int flags,
 	 */
 	ubi = open_ubi(name, UBI_READONLY);
 	if (IS_ERR(ubi)) {
-		pr_err("UBIFS error (pid: %d): cannot open \"%s\", error %d",
-		       current->pid, name, (int)PTR_ERR(ubi));
+		if (!(flags & MS_SILENT))
+			pr_err("UBIFS error (pid: %d): cannot open \"%s\", error %d",
+			       current->pid, name, (int)PTR_ERR(ubi));
 		return ERR_CAST(ubi);
 	}

I'll queue this patch for v4.8.

Thanks,
//richard