• Chao Yu's avatar
    f2fs: fix to wait on page writeback in __clone_blkaddrs() · d3876e34
    Chao Yu authored
    In below race condition, dst page may become writeback status
    in __clone_blkaddrs(), it needs to wait writeback before update,
    fix it.
    
    Thread A				GC Thread
    - f2fs_move_file_range
      - filemap_write_and_wait_range(dst)
    					- gc_data_segment
    					 - f2fs_down_write(dst)
    					 - move_data_page
    					  - set_page_writeback(dst_page)
    					  - f2fs_submit_page_write
    					 - f2fs_up_write(dst)
      - f2fs_down_write(dst)
      - __exchange_data_block
       - __clone_blkaddrs
        - f2fs_get_new_data_page
        - memcpy_page
    
    Fixes: 0a2aa8fb ("f2fs: refactor __exchange_data_block for speed up")
    Signed-off-by: default avatarChao Yu <chao@kernel.org>
    Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
    d3876e34
file.c 122 KB