lkml.org 
[lkml]   [2014]   [Nov]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/3] f2fs: fix deadlock to grab 0'th data page
Date
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 | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 54722a0..edc3ce8 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -477,8 +477,6 @@ int truncate_blocks(struct inode *inode, u64 from, bool lock)
}

if (f2fs_has_inline_data(inode)) {
- truncate_inline_data(ipage, from);
- update_inode(inode, ipage);
f2fs_put_page(ipage, 1);
goto out;
}
@@ -504,13 +502,13 @@ int truncate_blocks(struct inode *inode, u64 from, bool lock)
f2fs_put_dnode(&dn);
free_next:
err = truncate_inode_blocks(inode, free_from);
+out:
+ if (lock)
+ f2fs_unlock_op(sbi);

/* lastly zero out the first data page */
if (!err)
err = truncate_partial_data_page(inode, from);
-out:
- if (lock)
- f2fs_unlock_op(sbi);

trace_f2fs_truncate_blocks_exit(inode, err);
return err;
--
2.1.1


\
 
 \ /
  Last update: 2014-11-14 04:01    [W:0.053 / U:2.272 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site