summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/super.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2015-01-14 19:34:24 -0500
committerJaegeuk Kim <jaegeuk@kernel.org>2015-02-11 20:04:32 -0500
commit30a5537f9a9e91937aad6a47f55683f7ce0be257 (patch)
treecc6d7bb3b2e2c9bbe88ee450ed5d70c4fab233b7 /fs/f2fs/super.c
parent6f0aacbc3c1d71078d0f9eb47f8c422bb58fffd7 (diff)
f2fs: trigger correct checkpoint during umount
This patch fixes to trigger checkpoint with umount flag when kill_sb was called. In kill_sb, f2fs_sync_fs was finally called, but at this time, f2fs can't do checkpoint with CP_UMOUNT. After then, f2fs_put_super is not doing checkpoint, since it is not dirty. So, this patch adds a flag to indicate f2fs_sync_fs is called during umount. Reviewed-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/super.c')
-rw-r--r--fs/f2fs/super.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 0e97974bbbbd..84f95cd4076a 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -487,7 +487,8 @@ int f2fs_sync_fs(struct super_block *sb, int sync)
487 if (sync) { 487 if (sync) {
488 struct cp_control cpc; 488 struct cp_control cpc;
489 489
490 cpc.reason = test_opt(sbi, FASTBOOT) ? CP_UMOUNT : CP_SYNC; 490 cpc.reason = (test_opt(sbi, FASTBOOT) || sbi->s_closing) ?
491 CP_UMOUNT : CP_SYNC;
491 mutex_lock(&sbi->gc_mutex); 492 mutex_lock(&sbi->gc_mutex);
492 write_checkpoint(sbi, &cpc); 493 write_checkpoint(sbi, &cpc);
493 mutex_unlock(&sbi->gc_mutex); 494 mutex_unlock(&sbi->gc_mutex);
@@ -1190,11 +1191,18 @@ static struct dentry *f2fs_mount(struct file_system_type *fs_type, int flags,
1190 return mount_bdev(fs_type, flags, dev_name, data, f2fs_fill_super); 1191 return mount_bdev(fs_type, flags, dev_name, data, f2fs_fill_super);
1191} 1192}
1192 1193
1194static void kill_f2fs_super(struct super_block *sb)
1195{
1196 if (sb->s_root)
1197 F2FS_SB(sb)->s_closing = true;
1198 kill_block_super(sb);
1199}
1200
1193static struct file_system_type f2fs_fs_type = { 1201static struct file_system_type f2fs_fs_type = {
1194 .owner = THIS_MODULE, 1202 .owner = THIS_MODULE,
1195 .name = "f2fs", 1203 .name = "f2fs",
1196 .mount = f2fs_mount, 1204 .mount = f2fs_mount,
1197 .kill_sb = kill_block_super, 1205 .kill_sb = kill_f2fs_super,
1198 .fs_flags = FS_REQUIRES_DEV, 1206 .fs_flags = FS_REQUIRES_DEV,
1199}; 1207};
1200MODULE_ALIAS_FS("f2fs"); 1208MODULE_ALIAS_FS("f2fs");