• Chao Yu's avatar
    f2fs: refactor ->page_mkwrite() flow · 39a86958
    Chao Yu authored
    Thread A				Thread B
    - f2fs_vm_page_mkwrite
    					- f2fs_setattr
    					 - down_write(i_mmap_sem)
    					 - truncate_setsize
    					 - f2fs_truncate
    					 - up_write(i_mmap_sem)
     - f2fs_reserve_block
     reserve NEW_ADDR
     - skip dirty page due to truncation
    
    1. we don't need to rserve new block address for a truncated page.
    2. dn.data_blkaddr is used out of node page lock coverage.
    
    Refactor ->page_mkwrite() flow to fix above issues:
    - use __do_map_lock() to avoid racing checkpoint()
    - lock data page in prior to dnode page
    - cover f2fs_reserve_block with i_mmap_sem lock
    - wait page writeback before zeroing page
    Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
    Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
    39a86958
data.c 65.2 KB