android_kernel_oneplus_msm8998/fs/f2fs
Chao Yu a90ff12b2f f2fs: relocate chksum_offset for large_nat_bitmap feature
For large_nat_bitmap feature, there is a design flaw:

Previous:

struct f2fs_checkpoint layout:
+--------------------------+  0x0000
| checkpoint_ver           |
| ......                   |
| checksum_offset          |------+
| ......                   |      |
| sit_nat_version_bitmap[] |<-----|-------+
| ......                   |      |       |
| checksum_value           |<-----+       |
+--------------------------+  0x1000      |
|                          |      nat_bitmap + sit_bitmap
| payload blocks           |              |
|                          |              |
+--------------------------|<-------------+

Obviously, if nat_bitmap size + sit_bitmap size is larger than
MAX_BITMAP_SIZE_IN_CKPT, nat_bitmap or sit_bitmap may overlap
checkpoint checksum's position, once checkpoint() is triggered
from kernel, nat or sit bitmap will be damaged by checksum field.

In order to fix this, let's relocate checksum_value's position
to the head of sit_nat_version_bitmap as below, then nat/sit
bitmap and chksum value update will become safe.

After:

struct f2fs_checkpoint layout:
+--------------------------+  0x0000
| checkpoint_ver           |
| ......                   |
| checksum_offset          |------+
| ......                   |      |
| sit_nat_version_bitmap[] |<-----+
| ......                   |<-------------+
|                          |              |
+--------------------------+  0x1000      |
|                          |      nat_bitmap + sit_bitmap
| payload blocks           |              |
|                          |              |
+--------------------------|<-------------+

Related report and discussion:

https://sourceforge.net/p/linux-f2fs/mailman/message/36642346/

Reported-by: Park Ju Hyung <qkrwngud825@gmail.com>
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2019-05-08 22:00:10 -07:00
..
acl.c f2fs: Replace spaces with tab 2019-05-08 22:00:08 -07:00
acl.h f2fs: add SPDX license identifiers 2018-10-27 11:57:18 -07:00
checkpoint.c f2fs: relocate chksum_offset for large_nat_bitmap feature 2019-05-08 22:00:10 -07:00
data.c f2fs: introduce f2fs_read_single_page() for cleanup 2019-05-08 22:00:04 -07:00
debug.c f2fs: no need to check return value of debugfs_create functions 2019-02-04 10:33:49 -08:00
dir.c f2fs: fix to add refcount once page is tagged PG_private 2019-03-14 13:58:44 -07:00
extent_cache.c f2fs: add SPDX license identifiers 2018-10-27 11:57:18 -07:00
f2fs.h f2fs: relocate chksum_offset for large_nat_bitmap feature 2019-05-08 22:00:10 -07:00
file.c f2fs: allow address pointer number of dnode aligning to specified size 2019-05-08 22:00:06 -07:00
gc.c f2fs: allow address pointer number of dnode aligning to specified size 2019-05-08 22:00:06 -07:00
gc.h f2fs: add SPDX license identifiers 2018-10-27 11:57:18 -07:00
hash.c f2fs: add SPDX license identifiers 2018-10-27 11:57:18 -07:00
inline.c f2fs: fix to retrieve inline xattr space 2019-05-08 21:59:47 -07:00
inode.c f2fs: fix to do checksum even if inode page is uptodate 2019-05-08 21:59:56 -07:00
Kconfig f2fs: remove wrong backported codes 2017-01-11 09:55:38 -08:00
Makefile f2fs: move sysfs code from super.c to fs/f2fs/sysfs.c 2017-07-13 16:56:51 -07:00
namei.c f2fs: mark is_extension_exist() inline 2019-05-08 22:00:03 -07:00
node.c f2fs: allow address pointer number of dnode aligning to specified size 2019-05-08 22:00:06 -07:00
node.h f2fs: check PageWriteback flag for ordered case 2019-01-02 16:17:53 -08:00
recovery.c f2fs: fix to avoid panic in do_recover_data() 2019-05-08 21:59:58 -07:00
segment.c f2fs: fix to avoid panic in f2fs_inplace_write_data() 2019-05-08 22:00:01 -07:00
segment.h f2fs: fix to do sanity check on valid block count of segment 2019-05-08 22:00:00 -07:00
shrinker.c f2fs: fix sbi->extent_list corruption issue 2019-01-02 16:17:44 -08:00
super.c f2fs: allow address pointer number of dnode aligning to specified size 2019-05-08 22:00:06 -07:00
sysfs.c f2fs: run discard jobs when put_super 2019-02-04 10:33:59 -08:00
trace.c f2fs: do not use mutex lock in atomic context 2019-02-04 10:51:27 -08:00
trace.h f2fs: add SPDX license identifiers 2018-10-27 11:57:18 -07:00
xattr.c f2fs: fix to adapt small inline xattr space in __find_inline_xattr() 2019-03-14 14:17:31 -07:00
xattr.h f2fs: fix to do sanity check with inode.i_inline_xattr_size 2019-03-14 13:58:50 -07:00