• Chao Yu's avatar
    f2fs: fix to avoid potential panic during recovery · 21ec6823
    Chao Yu authored
    During recovery, if FAULT_BLOCK is on, it is possible that
    f2fs_reserve_new_block() will return -ENOSPC during recovery,
    then it may trigger panic.
    
    Also, if fault injection rate is 1 and only FAULT_BLOCK fault
    type is on, it may encounter deadloop in loop of block reservation.
    
    Let's change as below to fix these issues:
    - remove bug_on() to avoid panic.
    - limit the loop count of block reservation to avoid potential
    deadloop.
    
    Fixes: 956fa1dd ("f2fs: fix to check return value of f2fs_reserve_new_block()")
    Reported-by: default avatarZhiguo Niu <zhiguo.niu@unisoc.com>
    Signed-off-by: default avatarChao Yu <chao@kernel.org>
    Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
    21ec6823
recovery.c 23 KB