UBIFS: introduce mounting flag
This is a preparational patch which removes the 'c->always_chk_crc' which was set during mounting and remounting to R/W mode and introduces 'c->mounting' flag which is set when mounting. Now the 'c->always_chk_crc' flag is the same as 'c->remounting_rw && c->mounting'. This patch is a preparation for the next one which will need to know when we are mounting and remounting to R/W mode, which is exactly what 'c->always_chk_crc' effectively is, but its name does not suite the next patch. The other possibility would be to just re-name it, but then we'd end up with less logical flags coverage. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
This commit is contained in:
@@ -447,8 +447,11 @@ static int tnc_read_node_nm(struct ubifs_info *c, struct ubifs_zbranch *zbr,
|
||||
*
|
||||
* Note, this function does not check CRC of data nodes if @c->no_chk_data_crc
|
||||
* is true (it is controlled by corresponding mount option). However, if
|
||||
* @c->always_chk_crc is true, @c->no_chk_data_crc is ignored and CRC is always
|
||||
* checked.
|
||||
* @c->mounting or @c->remounting_rw is true (we are mounting or re-mounting to
|
||||
* R/W mode), @c->no_chk_data_crc is ignored and CRC is checked. This is
|
||||
* because during mounting or re-mounting from R/O mode to R/W mode we may read
|
||||
* journal nodes (when replying the journal or doing the recovery) and the
|
||||
* journal nodes may potentially be corrupted, so checking is required.
|
||||
*/
|
||||
static int try_read_node(const struct ubifs_info *c, void *buf, int type,
|
||||
int len, int lnum, int offs)
|
||||
@@ -476,7 +479,8 @@ static int try_read_node(const struct ubifs_info *c, void *buf, int type,
|
||||
if (node_len != len)
|
||||
return 0;
|
||||
|
||||
if (type == UBIFS_DATA_NODE && !c->always_chk_crc && c->no_chk_data_crc)
|
||||
if (type == UBIFS_DATA_NODE && c->no_chk_data_crc && !c->mounting &&
|
||||
!c->remounting_rw)
|
||||
return 1;
|
||||
|
||||
crc = crc32(UBIFS_CRC32_INIT, buf + 8, node_len - 8);
|
||||
|
Reference in New Issue
Block a user