diff options
Diffstat (limited to 'fs/ubifs/io.c')
-rw-r--r-- | fs/ubifs/io.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c index d82173182eeb..d1fe56203a1d 100644 --- a/fs/ubifs/io.c +++ b/fs/ubifs/io.c | |||
@@ -88,8 +88,12 @@ void ubifs_ro_mode(struct ubifs_info *c, int err) | |||
88 | * This function may skip data nodes CRC checking if @c->no_chk_data_crc is | 88 | * This function may skip data nodes CRC checking if @c->no_chk_data_crc is |
89 | * true, which is controlled by corresponding UBIFS mount option. However, if | 89 | * true, which is controlled by corresponding UBIFS mount option. However, if |
90 | * @must_chk_crc is true, then @c->no_chk_data_crc is ignored and CRC is | 90 | * @must_chk_crc is true, then @c->no_chk_data_crc is ignored and CRC is |
91 | * checked. Similarly, if @c->always_chk_crc is true, @c->no_chk_data_crc is | 91 | * checked. Similarly, if @c->mounting or @c->remounting_rw is true (we are |
92 | * ignored and CRC is checked. | 92 | * mounting or re-mounting to R/W mode), @c->no_chk_data_crc is ignored and CRC |
93 | * is checked. This is because during mounting or re-mounting from R/O mode to | ||
94 | * R/W mode we may read journal nodes (when replying the journal or doing the | ||
95 | * recovery) and the journal nodes may potentially be corrupted, so checking is | ||
96 | * required. | ||
93 | * | 97 | * |
94 | * This function returns zero in case of success and %-EUCLEAN in case of bad | 98 | * This function returns zero in case of success and %-EUCLEAN in case of bad |
95 | * CRC or magic. | 99 | * CRC or magic. |
@@ -131,8 +135,8 @@ int ubifs_check_node(const struct ubifs_info *c, const void *buf, int lnum, | |||
131 | node_len > c->ranges[type].max_len) | 135 | node_len > c->ranges[type].max_len) |
132 | goto out_len; | 136 | goto out_len; |
133 | 137 | ||
134 | if (!must_chk_crc && type == UBIFS_DATA_NODE && !c->always_chk_crc && | 138 | if (!must_chk_crc && type == UBIFS_DATA_NODE && !c->mounting && |
135 | c->no_chk_data_crc) | 139 | !c->remounting_rw && c->no_chk_data_crc) |
136 | return 0; | 140 | return 0; |
137 | 141 | ||
138 | crc = crc32(UBIFS_CRC32_INIT, buf + 8, node_len - 8); | 142 | crc = crc32(UBIFS_CRC32_INIT, buf + 8, node_len - 8); |