diff options
author | Zhe Li <lizhe67@huawei.com> | 2020-06-09 10:09:27 +0800 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2020-08-02 23:56:13 +0200 |
commit | a68005a36dc3a351957821d8820ffbfacb21dd36 (patch) | |
tree | 27bad486ae76bf0c22ab5ed878c1dd89df89ffd6 /fs/jffs2/security.c | |
parent | 094b6d1295474f338201b846a1f15e72eb0b12cf (diff) |
jffs2: fix jffs2 mounting failure
Thanks for the advice mentioned in the email.
This is my v3 patch for this problem.
Mounting jffs2 on nand flash will get message "failed: I/O error"
with the steps listed below.
1.umount jffs2
2.erase nand flash
3.mount jffs2 on it (this mounting operation will be successful)
4.do chown or chmod to the mount point directory
5.umount jffs2
6.mount jffs2 on nand flash
After step 6, we will get message "mount ... failed: I/O error".
Typical image of this problem is like:
Empty space found from 0x00000000 to 0x008a0000
Inode node at xx, totlen 0x00000044, #ino 1, version 1, isize 0...
The reason for this mounting failure is that at the end of function
jffs2_scan_medium(), jffs2 will check the used_size and some info
of nr_blocks.If conditions are met, it will return -EIO.
The detail is that, in the steps listed above, step 4 will write
jffs2_raw_inode into flash without jffs2_raw_dirent, which will
cause that there are some jffs2_raw_inode but no jffs2_raw_dirent
on flash. This will meet the condition at the end of function
jffs2_scan_medium() and return -EIO if we umount jffs2 and mount it
again.
We notice that jffs2 add the value of c->unchecked_size if we find
an inode node while mounting. And jffs2 will never add the value of
c->unchecked_size in other situations. So this patch add one more
condition about c->unchecked_size of the judgement to fix this problem.
Signed-off-by: Zhe Li <lizhe67@huawei.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'fs/jffs2/security.c')
0 files changed, 0 insertions, 0 deletions