OSDN Git Service

f2fs: fix deadlock to grab 0'th data page
authorJaegeuk Kim <jaegeuk@kernel.org>
Tue, 11 Nov 2014 19:01:01 +0000 (11:01 -0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 11 Nov 2014 22:15:48 +0000 (14:15 -0800)
commit764d2c80401fcc7ee15933d604c6a783d5addc40
tree4f2c237c79c273d32326cd72dcad2801009f702a
parent57e2a2c0a698406e6206ab707bd7c3dcf248c738
f2fs: fix deadlock to grab 0'th data page

The scenario is like this.

One trhead triggers:
  f2fs_write_data_pages
    lock_page
    f2fs_write_data_page
      f2fs_lock_op  <- wait

The other thread triggers:
  f2fs_truncate
    truncate_blocks
      f2fs_lock_op
        truncate_partial_data_page
          lock_page  <- wait for locking the page

This patch resolves this bug by relocating truncate_partial_data_page.
This function is just to truncate user data page and not related to FS
consistency as well.
And, we don't need to call truncate_inline_data. Rather than that,
f2fs_write_data_page will finally update inline_data later.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/file.c