In this cycle, f2fs has some performance improvements for Android workloads such
as using read-unfair rwsems and adding some sysfs entries to control GCs and
discard commands in more details. In addtiion, it has some tunings to improve
the recovery speed after sudden power-cut.

 - add reader-unfair rwsems with F2FS_UNFAIR_RWSEM
  : will replace with generic API support
 - adjust to make the readahead/recovery flow more efficiently
 - sysfs entries to control issue speeds of GCs and Discard commands
 - enable idmapped mounts

Bug fix:
 - correct wrong error handling routines
 - fix missing conditions in quota
 - fix a potential deadlock between writeback and block plug routines
 - fix a deadlock btween freezefs and evict_inode

We've added some boundary checks to avoid kernel panics on corrupted images,
and several minor code clean-ups.
f2fs: fix to do sanity check on .cp_pack_total_block_count

As bughunter reported in bugzilla:


f2fs may hang when mounting a fuzzed image, the dmesg shows as below:

__get_meta_page+0x95/0x460 [f2fs]
get_checkpoint_version+0x2a/0x1e0 [f2fs]
validate_checkpoint+0x8e/0x2a0 [f2fs]
f2fs_get_valid_checkpoint+0xd0/0x620 [f2fs]
f2fs_fill_super+0xc01/0x1d40 [f2fs]
f2fs_mount+0x15/0x20 [f2fs]

The root cause is cp_pack_total_block_count field in checkpoint was fuzzed
to one, as calcuated, two cp pack block locates in the same block address,
so then read latter cp pack block, it will block on the page lock due to
the lock has already held when reading previous cp pack block, fix it by
adding sanity check for cp_pack_total_block_count.

Cc: stable@vger.kernel.org
Signed-off-by: Chao Yu <chao.yu@oppo.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 file changed