]> git.baikalelectronics.ru Git - kernel.git/commit
f2fs: don't give partially written atomic data from process crash
authorJaegeuk Kim <jaegeuk@kernel.org>
Tue, 25 Jul 2017 02:46:29 +0000 (19:46 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Sat, 29 Jul 2017 00:49:01 +0000 (17:49 -0700)
commit0e0c433c381f2224fb369e20396e0de22b0a1274
tree5b8f062a85ac3d175d0686323fc4c051ce484a17
parentcfbe5e545dff92943e370eee7a0f77621fa24a03
f2fs: don't give partially written atomic data from process crash

This patch resolves the below scenario.

== Process 1 ==     == Process 2 ==
open(w)             open(rw)
begin
write(new_#1)
process_crash
  f_op->flush
  locks_remove_posix
  f_op>release
                    read (new_#1)

In order to avoid corrupted database caused by new_#1, we must do roll-back
at process_crash time. In order to check that, this patch keeps task which
triggers transaction begin, and does roll-back in f_op->flush before removing
file locks.

Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/f2fs.h
fs/f2fs/file.c