Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3cb5d942 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "f2fs: avoid race between gc and checkpoint in unmount path"

parents eff0d804 f0a08e41
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1040,10 +1040,13 @@ static void f2fs_umount_end(struct super_block *sb, int flags)
	if ((flags & MNT_FORCE) || atomic_read(&sb->s_active) > 1) {
		/* to write the latest kbytes_written */
		if (!(sb->s_flags & MS_RDONLY)) {
			struct f2fs_sb_info *sbi = F2FS_SB(sb);
			struct cp_control cpc = {
				.reason = CP_UMOUNT,
			};
			mutex_lock(&sbi->gc_mutex);
			f2fs_write_checkpoint(F2FS_SB(sb), &cpc);
			mutex_unlock(&sbi->gc_mutex);
		}
	}
}