1. 13 Mar, 2024 4 commits
    • Chao Yu's avatar
      f2fs: zone: fix to remove pow2 check condition for zoned block device · 11bec96a
      Chao Yu authored
      Commit 2e2c6e9b ("f2fs: remove power-of-two limitation of zoned
      device") missed to remove pow2 check condition in init_blkz_info(),
      fix it.
      
      Fixes: 2e2c6e9b ("f2fs: remove power-of-two limitation of zoned device")
      Signed-off-by: default avatarFeng Song <songfeng@oppo.com>
      Signed-off-by: default avatarYongpeng Yang <yangyongpeng1@oppo.com>
      Signed-off-by: default avatarChao Yu <chao@kernel.org>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      11bec96a
    • Chao Yu's avatar
      f2fs: fix to truncate meta inode pages forcely · 9f0c4a46
      Chao Yu authored
      Below race case can cause data corruption:
      
      Thread A				GC thread
      					- gc_data_segment
      					 - ra_data_block
      					  - locked meta_inode page
      - f2fs_inplace_write_data
       - invalidate_mapping_pages
       : fail to invalidate meta_inode page
         due to lock failure or dirty|writeback
         status
       - f2fs_submit_page_bio
       : write last dirty data to old blkaddr
      					 - move_data_block
      					  - load old data from meta_inode page
      					  - f2fs_submit_page_write
      					  : write old data to new blkaddr
      
      Because invalidate_mapping_pages() will skip invalidating page which
      has unclear status including locked, dirty, writeback and so on, so
      we need to use truncate_inode_pages_range() instead of
      invalidate_mapping_pages() to make sure meta_inode page will be dropped.
      
      Fixes: 6aa58d8a ("f2fs: readahead encrypted block during GC")
      Fixes: e3b49ea3 ("f2fs: invalidate META_MAPPING before IPU/DIO write")
      Signed-off-by: default avatarChao Yu <chao@kernel.org>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      9f0c4a46
    • Xiuhong Wang's avatar
      f2fs: compress: fix reserve_cblocks counting error when out of space · 2f6d721e
      Xiuhong Wang authored
      When a file only needs one direct_node, performing the following
      operations will cause the file to be unrepairable:
      
      unisoc # ./f2fs_io compress test.apk
      unisoc #df -h | grep dm-48
      /dev/block/dm-48 112G 112G 1.2M 100% /data
      
      unisoc # ./f2fs_io release_cblocks test.apk
      924
      unisoc # df -h | grep dm-48
      /dev/block/dm-48 112G 112G 4.8M 100% /data
      
      unisoc # dd if=/dev/random of=file4 bs=1M count=3
      3145728 bytes (3.0 M) copied, 0.025 s, 120 M/s
      unisoc # df -h | grep dm-48
      /dev/block/dm-48 112G 112G 1.8M 100% /data
      
      unisoc # ./f2fs_io reserve_cblocks test.apk
      F2FS_IOC_RESERVE_COMPRESS_BLOCKS failed: No space left on device
      
      adb reboot
      unisoc # df -h  | grep dm-48
      /dev/block/dm-48             112G 112G   11M 100% /data
      unisoc # ./f2fs_io reserve_cblocks test.apk
      0
      
      This is because the file has only one direct_node. After returning
      to -ENOSPC, reserved_blocks += ret will not be executed. As a result,
      the reserved_blocks at this time is still 0, which is not the real
      number of reserved blocks. Therefore, fsck cannot be set to repair
      the file.
      
      After this patch, the fsck flag will be set to fix this problem.
      
      unisoc # df -h | grep dm-48
      /dev/block/dm-48             112G 112G  1.8M 100% /data
      unisoc # ./f2fs_io reserve_cblocks test.apk
      F2FS_IOC_RESERVE_COMPRESS_BLOCKS failed: No space left on device
      
      adb reboot then fsck will be executed
      unisoc # df -h  | grep dm-48
      /dev/block/dm-48             112G 112G   11M 100% /data
      unisoc # ./f2fs_io reserve_cblocks test.apk
      924
      
      Fixes: c75488fb ("f2fs: introduce F2FS_IOC_RESERVE_COMPRESS_BLOCKS")
      Signed-off-by: default avatarXiuhong Wang <xiuhong.wang@unisoc.com>
      Signed-off-by: default avatarZhiguo Niu <zhiguo.niu@unisoc.com>
      Reviewed-by: default avatarChao Yu <chao@kernel.org>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      2f6d721e
    • Xiuhong Wang's avatar
      f2fs: compress: relocate some judgments in f2fs_reserve_compress_blocks · b7d797d2
      Xiuhong Wang authored
      The following f2fs_io test will get a "0" result instead of -EINVAL,
      unisoc # ./f2fs_io compress file
      unisoc # ./f2fs_io reserve_cblocks file
       0
      it's not reasonable, so the judgement of
      atomic_read(&F2FS_I(inode)->i_compr_blocks) should be placed after
      the judgement of is_inode_flag_set(inode, FI_COMPRESS_RELEASED).
      
      Fixes: c75488fb ("f2fs: introduce F2FS_IOC_RESERVE_COMPRESS_BLOCKS")
      Signed-off-by: default avatarXiuhong Wang <xiuhong.wang@unisoc.com>
      Signed-off-by: default avatarZhiguo Niu <zhiguo.niu@unisoc.com>
      Reviewed-by: default avatarChao Yu <chao@kernel.org>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      b7d797d2
  2. 06 Mar, 2024 1 commit
  3. 04 Mar, 2024 14 commits
  4. 29 Feb, 2024 8 commits
  5. 27 Feb, 2024 10 commits
  6. 20 Feb, 2024 1 commit
  7. 06 Feb, 2024 2 commits