diff options
author | Daniel Golle <daniel@makrotopia.org> | 2014-06-02 09:51:10 -0400 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2014-06-02 11:00:52 -0400 |
commit | 90bea5a3f0bf680b87b90516f3c231997f4b8f3b (patch) | |
tree | af096de2a3a5b5f4d61a5bae06331fed9854534b /fs/ubifs | |
parent | 72abc8f4b4e8574318189886de627a2bfe6cd0da (diff) |
UBIFS: respect MS_SILENT mount flag
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.
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.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'fs/ubifs')
-rw-r--r-- | fs/ubifs/io.c | 18 | ||||
-rw-r--r-- | fs/ubifs/super.c | 5 | ||||
-rw-r--r-- | fs/ubifs/ubifs.h | 11 |
3 files changed, 26 insertions, 8 deletions
diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c index e18b9889a51b..2290d5866725 100644 --- a/fs/ubifs/io.c +++ b/fs/ubifs/io.c | |||
@@ -988,30 +988,32 @@ int ubifs_read_node(const struct ubifs_info *c, void *buf, int type, int len, | |||
988 | return err; | 988 | return err; |
989 | 989 | ||
990 | if (type != ch->node_type) { | 990 | if (type != ch->node_type) { |
991 | ubifs_err("bad node type (%d but expected %d)", | 991 | ubifs_errc(c, "bad node type (%d but expected %d)", |
992 | ch->node_type, type); | 992 | ch->node_type, type); |
993 | goto out; | 993 | goto out; |
994 | } | 994 | } |
995 | 995 | ||
996 | err = ubifs_check_node(c, buf, lnum, offs, 0, 0); | 996 | err = ubifs_check_node(c, buf, lnum, offs, 0, 0); |
997 | if (err) { | 997 | if (err) { |
998 | ubifs_err("expected node type %d", type); | 998 | ubifs_errc(c, "expected node type %d", type); |
999 | return err; | 999 | return err; |
1000 | } | 1000 | } |
1001 | 1001 | ||
1002 | l = le32_to_cpu(ch->len); | 1002 | l = le32_to_cpu(ch->len); |
1003 | if (l != len) { | 1003 | if (l != len) { |
1004 | ubifs_err("bad node length %d, expected %d", l, len); | 1004 | ubifs_errc(c, "bad node length %d, expected %d", l, len); |
1005 | goto out; | 1005 | goto out; |
1006 | } | 1006 | } |
1007 | 1007 | ||
1008 | return 0; | 1008 | return 0; |
1009 | 1009 | ||
1010 | out: | 1010 | out: |
1011 | ubifs_err("bad node at LEB %d:%d, LEB mapping status %d", lnum, offs, | 1011 | ubifs_errc(c, "bad node at LEB %d:%d, LEB mapping status %d", lnum, |
1012 | ubi_is_mapped(c->ubi, lnum)); | 1012 | offs, ubi_is_mapped(c->ubi, lnum)); |
1013 | ubifs_dump_node(c, buf); | 1013 | if (!c->probing) { |
1014 | dump_stack(); | 1014 | ubifs_dump_node(c, buf); |
1015 | dump_stack(); | ||
1016 | } | ||
1015 | return -EINVAL; | 1017 | return -EINVAL; |
1016 | } | 1018 | } |
1017 | 1019 | ||
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index a81c7b556896..3904c8574ef9 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
@@ -1149,6 +1149,9 @@ static int mount_ubifs(struct ubifs_info *c) | |||
1149 | size_t sz; | 1149 | size_t sz; |
1150 | 1150 | ||
1151 | c->ro_mount = !!(c->vfs_sb->s_flags & MS_RDONLY); | 1151 | c->ro_mount = !!(c->vfs_sb->s_flags & MS_RDONLY); |
1152 | /* Suppress error messages while probing if MS_SILENT is set */ | ||
1153 | c->probing = !!(c->vfs_sb->s_flags & MS_SILENT); | ||
1154 | |||
1152 | err = init_constants_early(c); | 1155 | err = init_constants_early(c); |
1153 | if (err) | 1156 | if (err) |
1154 | return err; | 1157 | return err; |
@@ -1214,6 +1217,8 @@ static int mount_ubifs(struct ubifs_info *c) | |||
1214 | if (err) | 1217 | if (err) |
1215 | goto out_free; | 1218 | goto out_free; |
1216 | 1219 | ||
1220 | c->probing = 0; | ||
1221 | |||
1217 | /* | 1222 | /* |
1218 | * Make sure the compressor which is set as default in the superblock | 1223 | * Make sure the compressor which is set as default in the superblock |
1219 | * or overridden by mount options is actually compiled in. | 1224 | * or overridden by mount options is actually compiled in. |
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index e8c8cfe1435c..c1f71fe17cc0 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h | |||
@@ -51,6 +51,15 @@ | |||
51 | #define ubifs_warn(fmt, ...) \ | 51 | #define ubifs_warn(fmt, ...) \ |
52 | pr_warn("UBIFS warning (pid %d): %s: " fmt "\n", \ | 52 | pr_warn("UBIFS warning (pid %d): %s: " fmt "\n", \ |
53 | current->pid, __func__, ##__VA_ARGS__) | 53 | current->pid, __func__, ##__VA_ARGS__) |
54 | /* | ||
55 | * A variant of 'ubifs_err()' which takes the UBIFS file-sytem description | ||
56 | * object as an argument. | ||
57 | */ | ||
58 | #define ubifs_errc(c, fmt, ...) \ | ||
59 | do { \ | ||
60 | if (!(c)->probing) \ | ||
61 | ubifs_err(fmt, ##__VA_ARGS__); \ | ||
62 | } while (0) | ||
54 | 63 | ||
55 | /* UBIFS file system VFS magic number */ | 64 | /* UBIFS file system VFS magic number */ |
56 | #define UBIFS_SUPER_MAGIC 0x24051905 | 65 | #define UBIFS_SUPER_MAGIC 0x24051905 |
@@ -1209,6 +1218,7 @@ struct ubifs_debug_info; | |||
1209 | * @need_recovery: %1 if the file-system needs recovery | 1218 | * @need_recovery: %1 if the file-system needs recovery |
1210 | * @replaying: %1 during journal replay | 1219 | * @replaying: %1 during journal replay |
1211 | * @mounting: %1 while mounting | 1220 | * @mounting: %1 while mounting |
1221 | * @probing: %1 while attempting to mount if MS_SILENT mount flag is set | ||
1212 | * @remounting_rw: %1 while re-mounting from R/O mode to R/W mode | 1222 | * @remounting_rw: %1 while re-mounting from R/O mode to R/W mode |
1213 | * @replay_list: temporary list used during journal replay | 1223 | * @replay_list: temporary list used during journal replay |
1214 | * @replay_buds: list of buds to replay | 1224 | * @replay_buds: list of buds to replay |
@@ -1441,6 +1451,7 @@ struct ubifs_info { | |||
1441 | unsigned int replaying:1; | 1451 | unsigned int replaying:1; |
1442 | unsigned int mounting:1; | 1452 | unsigned int mounting:1; |
1443 | unsigned int remounting_rw:1; | 1453 | unsigned int remounting_rw:1; |
1454 | unsigned int probing:1; | ||
1444 | struct list_head replay_list; | 1455 | struct list_head replay_list; |
1445 | struct list_head replay_buds; | 1456 | struct list_head replay_buds; |
1446 | unsigned long long cs_sqnum; | 1457 | unsigned long long cs_sqnum; |