Commit 3bdb7f16 authored by Jaegeuk Kim's avatar Jaegeuk Kim

f2fs: don't set RO when shutting down f2fs

Shutdown does not check the error of thaw_super due to readonly, which
causes a deadlock like below.

f2fs_ioc_shutdown(F2FS_GOING_DOWN_FULLSYNC)        issue_discard_thread
 - bdev_freeze
  - freeze_super
 - f2fs_stop_checkpoint()
  - f2fs_handle_critical_error                     - sb_start_write
    - set RO                                         - waiting
 - bdev_thaw
  - thaw_super_locked
    - return -EINVAL, if sb_rdonly()
 - f2fs_stop_discard_thread
  -> wait for kthread_stop(discard_thread);
Reported-by: default avatar"Light Hsieh (謝明燈)" <Light.Hsieh@mediatek.com>
Reviewed-by: default avatarDaeho Jeong <daehojeong@google.com>
Reviewed-by: default avatarChao Yu <chao@kernel.org>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent e07230da
......@@ -4159,9 +4159,15 @@ void f2fs_handle_critical_error(struct f2fs_sb_info *sbi, unsigned char reason,
if (shutdown)
set_sbi_flag(sbi, SBI_IS_SHUTDOWN);
/* continue filesystem operators if errors=continue */
if (continue_fs || f2fs_readonly(sb))
/*
* Continue filesystem operators if errors=continue. Should not set
* RO by shutdown, since RO bypasses thaw_super which can hang the
* system.
*/
if (continue_fs || f2fs_readonly(sb) || shutdown) {
f2fs_warn(sbi, "Stopped filesystem due to reason: %d", reason);
return;
}
f2fs_warn(sbi, "Remounting filesystem read-only");
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment