f2fs: stop gc/discard thread after fs shutdown

Once filesystem shuts down, daemons like gc/discard thread should be
aware of it, and do exit, in addtion, drop all cached pending discard
commands and turn off real-time discard mode.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
Chao Yu
2018-01-18 17:23:29 +08:00
committed by Jaegeuk Kim
parent d027c48447
commit 7950e9ac63
3 changed files with 13 additions and 0 deletions

View File

@@ -1866,6 +1866,13 @@ static int f2fs_ioc_shutdown(struct file *filp, unsigned long arg)
ret = -EINVAL;
goto out;
}
stop_gc_thread(sbi);
stop_discard_thread(sbi);
drop_discard_cmd(sbi);
clear_opt(sbi, DISCARD);
f2fs_update_time(sbi, REQ_TIME);
out:
mnt_drop_write_file(filp);