Skip to content
  1. Feb 03, 2023
  2. Feb 01, 2023
  3. Jan 31, 2023
  4. Jan 12, 2023
  5. Jan 07, 2023
    • Yuwei Guan's avatar
      f2fs: deliver the accumulated 'issued' to __issue_discard_cmd_orderly() · 185a453b
      Yuwei Guan authored
      
      
      Any of the following scenarios will send more than the number of
      max_requests at a time, which will not meet the design of the
      max_requests limit.
      
      - Set max_ordered_discard larger than discard_granularity from userspace.
      - It is a small size device, discard_granularity can be tuned to 1 in
        f2fs_tuning_parameters().
      
      We need to deliver the accumulated @issued to __issue_discard_cmd_orderly()
      to meet the max_requests limit.
      
      BTW, convert the parameter type of @issued in __submit_discard_cmd().
      
      Signed-off-by: default avatarYuwei Guan <Yuwei.Guan@zeekrlife.com>
      Cc: Bagas Sanjaya <bagasdotme@gmail.com>
      Reviewed-by: default avatarChao Yu <chao@kernel.org>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      185a453b
    • Chao Yu's avatar
      f2fs: avoid to check PG_error flag · 8358014d
      Chao Yu authored
      After below changes:
      commit 14db0b3c ("fscrypt: stop using PG_error to track error status")
      commit 98dc08ba
      
       ("fsverity: stop using PG_error to track error status")
      
      There is no place in f2fs we will set PG_error flag in page, let's remove
      other PG_error usage in f2fs, as a step towards freeing the PG_error flag
      for other uses.
      
      Cc: Eric Biggers <ebiggers@kernel.org>
      Signed-off-by: default avatarChao Yu <chao@kernel.org>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      8358014d
    • Chao Yu's avatar
      f2fs: add missing doc for fault injection sysfs · cec32b00
      Chao Yu authored
      We supported configuring fault injection parameter via sysfs w/
      below commits, however, we forgot to add doc entry, fix it.
      
      commit 08796897 ("f2fs: add fault injection to sysfs")
      /sys/fs/f2fs/fault_injection/fault_*
      
      commit 1ecc0c5c
      
       ("f2fs: support configuring fault injection per superblock")
      /sys/fs/f2fs/<device>/fault_*
      
      Cc: Sheng Yong <shengyong@oppo.com>
      Signed-off-by: default avatarChao Yu <chao@kernel.org>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      cec32b00
    • Chao Yu's avatar
      f2fs: fix to avoid potential deadlock · 5eaac835
      Chao Yu authored
      There is a potential deadlock reported by syzbot as below:
      
      F2FS-fs (loop2): invalid crc value
      F2FS-fs (loop2): Found nat_bits in checkpoint
      F2FS-fs (loop2): Mounted with checkpoint version = 48b305e4
      ======================================================
      WARNING: possible circular locking dependency detected
      6.1.0-rc8-syzkaller-33330-ga5541c0811a0 #0 Not tainted
      ------------------------------------------------------
      syz-executor.2/32123 is trying to acquire lock:
      ffff0000c0e1a608 (&mm->mmap_lock){++++}-{3:3}, at: __might_fault+0x54/0xb4 mm/memory.c:5644
      
      but task is already holding lock:
      ffff0001317c6088 (&sbi->sb_lock){++++}-{3:3}, at: f2fs_down_write fs/f2fs/f2fs.h:2205 [inline]
      ffff0001317c6088 (&sbi->sb_lock){++++}-{3:3}, at: f2fs_ioc_get_encryption_pwsalt fs/f2fs/file.c:2334 [inline]
      ffff0001317c6088 (&sbi->sb_lock){++++}-{3:3}, at: __f2fs_ioctl+0x1370/0x3318 fs/f2fs/file.c:4151
      
      which lock already depends on the new lock.
      
      Chain exists of:
        &mm->mmap_lock --> &nm_i->nat_tree_lock --> &sbi->sb_lock
      
       Possible unsafe locking scenario:
      
             CPU0                    CPU1
             ----                    ----
        lock(&sbi->sb_lock);
                                     lock(&nm_i->nat_tree_lock);
                                     lock(&sbi->sb_lock);
        lock(&mm->mmap_lock);
      
      Let's try to avoid above deadlock condition by moving __might_fault()
      out of sbi->sb_lock coverage.
      
      Fixes: 95fa90c9 ("f2fs: support recording errors into superblock")
      Link: https://lore.kernel.org/linux-f2fs-devel/000000000000cd5fe305ef617fe2@google.com/T/#u
      
      
      Reported-by: default avatar <syzbot+4793f6096d174c90b4f7@syzkaller.appspotmail.com>
      Signed-off-by: default avatarChao Yu <chao@kernel.org>
      Reviewed-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      5eaac835
    • Yangtao Li's avatar
      f2fs: introduce IS_F2FS_IPU_* macro · fdb7ccc3
      Yangtao Li authored
      
      
      IS_F2FS_IPU_* macro can be used to identify whether
      f2fs ipu related policies are enabled.
      
      BTW, convert to use BIT() instead of open code.
      
      Signed-off-by: default avatarYangtao Li <frank.li@vivo.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      fdb7ccc3