f2fs: avoid unable to restart gc thread in remount
authorChao Yu <chao2.yu@samsung.com>
Tue, 18 Nov 2014 03:16:01 +0000 (11:16 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Thu, 20 Nov 2014 06:49:30 +0000 (22:49 -0800)
In f2fs_remount, we will stop gc thread and set need_restart_gc as true when new
option is set without BG_GC, then if any error occurred in the following
procedure, we can restore to start the gc thread.
But after that, We will fail to restore gc thread in start_gc_thread as BG_GC is
not set in new option, so we'd better move this condition judgment out of
start_gc_thread to fix this issue.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/gc.c
fs/f2fs/super.c

index b197a2f2993a3f7c48e5d8e84c80ab7759101d8b..657683c9ee48103cb25d22f70e0c72caee8a0d24 100644 (file)
@@ -96,8 +96,6 @@ int start_gc_thread(struct f2fs_sb_info *sbi)
        dev_t dev = sbi->sb->s_bdev->bd_dev;
        int err = 0;
 
-       if (!test_opt(sbi, BG_GC))
-               goto out;
        gc_th = kmalloc(sizeof(struct f2fs_gc_kthread), GFP_KERNEL);
        if (!gc_th) {
                err = -ENOMEM;
index 512ffd8e16242edf48a3526c62d1c3e9e2a713e2..536d414017481d0b9eca210513459f8cab33d48d 100644 (file)
@@ -1138,7 +1138,7 @@ try_onemore:
         * If filesystem is not mounted as read-only then
         * do start the gc_thread.
         */
-       if (!f2fs_readonly(sb)) {
+       if (test_opt(sbi, BG_GC) && !f2fs_readonly(sb)) {
                /* After POR, we can run background GC thread.*/
                err = start_gc_thread(sbi);
                if (err)
This page took 0.026825 seconds and 5 git commands to generate.