f2fs: avoid freed stat information
authorJaegeuk Kim <jaegeuk@kernel.org>
Mon, 15 Jun 2015 21:52:29 +0000 (14:52 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 4 Aug 2015 21:09:53 +0000 (14:09 -0700)
The write_checkpoint can update stat information, so we should destroy the stat
structure after it.

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

index a06b0b46fe6952de875dc36b0c4e90c0ce980c31..da277100dc90931cdaba3fcceae226accb7a8aab 100644 (file)
@@ -498,7 +498,6 @@ static void f2fs_put_super(struct super_block *sb)
        }
        kobject_del(&sbi->s_kobj);
 
-       f2fs_destroy_stats(sbi);
        stop_gc_thread(sbi);
 
        /*
@@ -514,6 +513,9 @@ static void f2fs_put_super(struct super_block *sb)
                write_checkpoint(sbi, &cpc);
        }
 
+       /* write_checkpoint can update stat informaion */
+       f2fs_destroy_stats(sbi);
+
        /*
         * normally superblock is clean, so we need to release this.
         * In addition, EIO will skip do checkpoint, we need this as well.