2014-06-16 18:54:57 +00:00
|
|
|
From 90bea5a3f0bf680b87b90516f3c231997f4b8f3b Mon Sep 17 00:00:00 2001
|
2014-06-11 12:59:15 +00:00
|
|
|
From: Daniel Golle <daniel@makrotopia.org>
|
2014-06-16 18:54:57 +00:00
|
|
|
Date: Mon, 2 Jun 2014 15:51:10 +0200
|
|
|
|
X-Git-Url: http://git.infradead.org/linux-ubifs.git/commitdiff_plain/90bea5a3f0bf680b87b90516f3c231997f4b8f3b
|
|
|
|
X-Git-Url: https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/?id=90bea5a3f0bf680b87b90516f3c231997f4b8f3b
|
|
|
|
Subject: UBIFS: respect MS_SILENT mount flag
|
2014-06-11 12:59:15 +00:00
|
|
|
|
|
|
|
When attempting to mount a non-ubifs formatted volume, lots of error
|
|
|
|
messages (including a stack dump) are thrown to the kernel log even if
|
|
|
|
the MS_SILENT mount flag is set.
|
2014-06-16 18:54:57 +00:00
|
|
|
Fix this by introducing adding an additional state-variable in
|
|
|
|
struct ubifs_info and suppress error messages in ubifs_read_node if
|
|
|
|
MS_SILENT is set.
|
2014-06-11 12:59:15 +00:00
|
|
|
|
|
|
|
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
2014-06-16 18:54:57 +00:00
|
|
|
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
|
|
|
|
---
|
|
|
|
fs/ubifs/io.c | 18 ++++++++++--------
|
|
|
|
fs/ubifs/super.c | 5 +++++
|
|
|
|
fs/ubifs/ubifs.h | 11 +++++++++++
|
|
|
|
3 files changed, 26 insertions(+), 8 deletions(-)
|
|
|
|
|
2014-06-11 12:59:15 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
--- a/fs/ubifs/io.c
|
|
|
|
+++ b/fs/ubifs/io.c
|
2014-06-26 13:47:46 +00:00
|
|
|
@@ -988,30 +988,32 @@ int ubifs_read_node(const struct ubifs_i
|
2014-06-11 12:59:15 +00:00
|
|
|
return err;
|
|
|
|
|
|
|
|
if (type != ch->node_type) {
|
|
|
|
- ubifs_err("bad node type (%d but expected %d)",
|
2014-06-16 18:54:57 +00:00
|
|
|
- ch->node_type, type);
|
|
|
|
+ ubifs_errc(c, "bad node type (%d but expected %d)",
|
|
|
|
+ ch->node_type, type);
|
2014-06-11 12:59:15 +00:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
err = ubifs_check_node(c, buf, lnum, offs, 0, 0);
|
|
|
|
if (err) {
|
|
|
|
- ubifs_err("expected node type %d", type);
|
2014-06-16 18:54:57 +00:00
|
|
|
+ ubifs_errc(c, "expected node type %d", type);
|
2014-06-11 12:59:15 +00:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
l = le32_to_cpu(ch->len);
|
|
|
|
if (l != len) {
|
|
|
|
- ubifs_err("bad node length %d, expected %d", l, len);
|
2014-06-16 18:54:57 +00:00
|
|
|
+ ubifs_errc(c, "bad node length %d, expected %d", l, len);
|
2014-06-11 12:59:15 +00:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
out:
|
|
|
|
- ubifs_err("bad node at LEB %d:%d, LEB mapping status %d", lnum, offs,
|
|
|
|
- ubi_is_mapped(c->ubi, lnum));
|
|
|
|
- ubifs_dump_node(c, buf);
|
|
|
|
- dump_stack();
|
2014-06-16 18:54:57 +00:00
|
|
|
+ ubifs_errc(c, "bad node at LEB %d:%d, LEB mapping status %d", lnum,
|
|
|
|
+ offs, ubi_is_mapped(c->ubi, lnum));
|
|
|
|
+ if (!c->probing) {
|
2014-06-11 12:59:15 +00:00
|
|
|
+ ubifs_dump_node(c, buf);
|
|
|
|
+ dump_stack();
|
|
|
|
+ }
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2014-06-16 18:54:57 +00:00
|
|
|
--- a/fs/ubifs/super.c
|
|
|
|
+++ b/fs/ubifs/super.c
|
2014-06-26 13:47:46 +00:00
|
|
|
@@ -1164,6 +1164,9 @@ static int mount_ubifs(struct ubifs_info
|
2014-06-16 18:54:57 +00:00
|
|
|
size_t sz;
|
2014-06-11 12:59:15 +00:00
|
|
|
|
2014-06-16 18:54:57 +00:00
|
|
|
c->ro_mount = !!(c->vfs_sb->s_flags & MS_RDONLY);
|
|
|
|
+ /* Suppress error messages while probing if MS_SILENT is set */
|
|
|
|
+ c->probing = !!(c->vfs_sb->s_flags & MS_SILENT);
|
|
|
|
+
|
|
|
|
err = init_constants_early(c);
|
|
|
|
if (err)
|
2014-06-11 12:59:15 +00:00
|
|
|
return err;
|
2014-06-26 13:47:46 +00:00
|
|
|
@@ -1229,6 +1232,8 @@ static int mount_ubifs(struct ubifs_info
|
2014-06-16 18:54:57 +00:00
|
|
|
if (err)
|
|
|
|
goto out_free;
|
2014-06-11 12:59:15 +00:00
|
|
|
|
2014-06-16 18:54:57 +00:00
|
|
|
+ c->probing = 0;
|
|
|
|
+
|
|
|
|
/*
|
|
|
|
* Make sure the compressor which is set as default in the superblock
|
|
|
|
* or overridden by mount options is actually compiled in.
|
2014-06-11 12:59:15 +00:00
|
|
|
--- a/fs/ubifs/ubifs.h
|
|
|
|
+++ b/fs/ubifs/ubifs.h
|
2014-06-16 18:54:57 +00:00
|
|
|
@@ -51,6 +51,15 @@
|
|
|
|
#define ubifs_warn(fmt, ...) \
|
|
|
|
pr_warn("UBIFS warning (pid %d): %s: " fmt "\n", \
|
|
|
|
current->pid, __func__, ##__VA_ARGS__)
|
|
|
|
+/*
|
|
|
|
+ * A variant of 'ubifs_err()' which takes the UBIFS file-sytem description
|
|
|
|
+ * object as an argument.
|
|
|
|
+ */
|
|
|
|
+#define ubifs_errc(c, fmt, ...) \
|
|
|
|
+ do { \
|
|
|
|
+ if (!(c)->probing) \
|
|
|
|
+ ubifs_err(fmt, ##__VA_ARGS__); \
|
|
|
|
+ } while (0)
|
|
|
|
|
|
|
|
/* UBIFS file system VFS magic number */
|
|
|
|
#define UBIFS_SUPER_MAGIC 0x24051905
|
|
|
|
@@ -1209,6 +1218,7 @@ struct ubifs_debug_info;
|
|
|
|
* @need_recovery: %1 if the file-system needs recovery
|
|
|
|
* @replaying: %1 during journal replay
|
|
|
|
* @mounting: %1 while mounting
|
|
|
|
+ * @probing: %1 while attempting to mount if MS_SILENT mount flag is set
|
|
|
|
* @remounting_rw: %1 while re-mounting from R/O mode to R/W mode
|
|
|
|
* @replay_list: temporary list used during journal replay
|
|
|
|
* @replay_buds: list of buds to replay
|
|
|
|
@@ -1441,6 +1451,7 @@ struct ubifs_info {
|
|
|
|
unsigned int replaying:1;
|
|
|
|
unsigned int mounting:1;
|
|
|
|
unsigned int remounting_rw:1;
|
|
|
|
+ unsigned int probing:1;
|
|
|
|
struct list_head replay_list;
|
|
|
|
struct list_head replay_buds;
|
|
|
|
unsigned long long cs_sqnum;
|