linux/fs/f2fs
Sheng Yong 2866fb16d6 f2fs: fix race between write_checkpoint and write_begin
The following race could lead to inconsistent SIT bitmap:

Task A                          Task B
======                          ======
f2fs_write_checkpoint
  block_operations
    f2fs_lock_all
      down_write(node_change)
      down_write(node_write)
      ... sync ...
      up_write(node_change)
                                f2fs_file_write_iter
                                  set_inode_flag(FI_NO_PREALLOC)
                                  ......
                                  f2fs_write_begin(index=0, has inline data)
                                    prepare_write_begin
                                      __do_map_lock(AIO) => down_read(node_change)
                                      f2fs_convert_inline_page => update SIT
                                      __do_map_lock(AIO) => up_read(node_change)
  f2fs_flush_sit_entries <= inconsistent SIT
  finish write checkpoint
  sudden-power-off

If SPO occurs after checkpoint is finished, SIT bitmap will be set
incorrectly.

Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2018-11-26 15:53:57 -08:00
..
acl.c f2fs: add SPDX license identifiers 2018-09-12 13:07:10 -07:00
acl.h f2fs: add SPDX license identifiers 2018-09-12 13:07:10 -07:00
checkpoint.c f2fs: clean up f2fs_sb_has_##feature_name 2018-11-26 15:53:55 -08:00
data.c f2fs: fix race between write_checkpoint and write_begin 2018-11-26 15:53:57 -08:00
debug.c f2fs: add to account direct IO 2018-11-26 15:53:56 -08:00
dir.c f2fs: check memory boundary by insane namelen 2018-11-26 15:53:57 -08:00
extent_cache.c f2fs: use rb_*_cached friends 2018-10-16 09:36:59 -07:00
f2fs.h f2fs: fix out-place-update DIO write 2018-11-26 15:53:56 -08:00
file.c f2fs: fix out-place-update DIO write 2018-11-26 15:53:56 -08:00
gc.c f2fs: support subsectional garbage collection 2018-11-26 15:53:55 -08:00
gc.h f2fs: add SPDX license identifiers 2018-09-12 13:07:10 -07:00
hash.c f2fs: add SPDX license identifiers 2018-09-12 13:07:10 -07:00
inline.c Merge branch 'xarray' of git://git.infradead.org/users/willy/linux-dax 2018-10-28 11:35:40 -07:00
inode.c f2fs: clean up f2fs_sb_has_##feature_name 2018-11-26 15:53:55 -08:00
Kconfig fs/*/Kconfig: drop links to 404-compliant http://acl.bestbits.at 2018-01-01 12:45:37 -07:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
namei.c f2fs: clean up f2fs_sb_has_##feature_name 2018-11-26 15:53:55 -08:00
node.c f2fs: clean up f2fs_sb_has_##feature_name 2018-11-26 15:53:55 -08:00
node.h f2fs: add SPDX license identifiers 2018-09-12 13:07:10 -07:00
recovery.c f2fs: clean up f2fs_sb_has_##feature_name 2018-11-26 15:53:55 -08:00
segment.c f2fs: introduce __is_large_section() for cleanup 2018-11-26 15:53:55 -08:00
segment.h f2fs: introduce __is_large_section() for cleanup 2018-11-26 15:53:55 -08:00
shrinker.c f2fs: add SPDX license identifiers 2018-09-12 13:07:10 -07:00
super.c f2fs: support subsectional garbage collection 2018-11-26 15:53:55 -08:00
sysfs.c f2fs: export migration_granularity sysfs entry 2018-11-26 15:53:56 -08:00
trace.c f2fs: add SPDX license identifiers 2018-09-12 13:07:10 -07:00
trace.h f2fs: add SPDX license identifiers 2018-09-12 13:07:10 -07:00
xattr.c f2fs: add SPDX license identifiers 2018-09-12 13:07:10 -07:00
xattr.h f2fs: add SPDX license identifiers 2018-09-12 13:07:10 -07:00