diff options
author | Jason Hrycay <jason.hrycay@motorola.com> | 2013-04-08 21:16:44 -0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-04-09 04:22:45 -0400 |
commit | 1127a3d448bcf4de338e60a7cc695d54c5767433 (patch) | |
tree | 7b7dee3b1eedecd5d5d125f5a6e919fc2fb46d10 /fs/f2fs | |
parent | 49952fa182a2e9b3f40b974278c5b1144f0c918b (diff) |
f2fs: move f2fs_balance_fs from truncate to punch_hole
Move the f2fs_balance_fs out of the truncate_hole function and only
perform that in punch_hole use case. The commit:
ed60b1644e7f7e5dd67d21caf7e4425dff05dad0
intended to do this but moved it into truncate_hole to cover more
cases. However, a deadlock scenario is possible when deleting an inode
entry under specific conditions:
f2fs_delete_entry()
mutex_lock_op(sbi, DENTRY_OPS);
truncate_hole()
f2fs_balance_fs()
mutex_lock(&sbi->gc_mutex);
f2fs_gc()
write_checkpoint()
block_operations()
mutex_lock_op(sbi, DENTRY_OPS);
Lets move it into the punch_hole case to cover the original intent of
avoiding it during fallocate's expand_inode_data case.
Change-Id: I29f8ea1056b0b88b70ba8652d901b6e8431bb27e
Signed-off-by: Jason Hrycay <jason.hrycay@motorola.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/file.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index e031f570df79..155b362dad63 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c | |||
@@ -390,8 +390,6 @@ int truncate_hole(struct inode *inode, pgoff_t pg_start, pgoff_t pg_end) | |||
390 | struct dnode_of_data dn; | 390 | struct dnode_of_data dn; |
391 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); | 391 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); |
392 | 392 | ||
393 | f2fs_balance_fs(sbi); | ||
394 | |||
395 | mutex_lock_op(sbi, DATA_TRUNC); | 393 | mutex_lock_op(sbi, DATA_TRUNC); |
396 | set_new_dnode(&dn, inode, NULL, NULL, 0); | 394 | set_new_dnode(&dn, inode, NULL, NULL, 0); |
397 | err = get_dnode_of_data(&dn, index, LOOKUP_NODE); | 395 | err = get_dnode_of_data(&dn, index, LOOKUP_NODE); |
@@ -435,6 +433,9 @@ static int punch_hole(struct inode *inode, loff_t offset, loff_t len, int mode) | |||
435 | if (pg_start < pg_end) { | 433 | if (pg_start < pg_end) { |
436 | struct address_space *mapping = inode->i_mapping; | 434 | struct address_space *mapping = inode->i_mapping; |
437 | loff_t blk_start, blk_end; | 435 | loff_t blk_start, blk_end; |
436 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); | ||
437 | |||
438 | f2fs_balance_fs(sbi); | ||
438 | 439 | ||
439 | blk_start = pg_start << PAGE_CACHE_SHIFT; | 440 | blk_start = pg_start << PAGE_CACHE_SHIFT; |
440 | blk_end = pg_end << PAGE_CACHE_SHIFT; | 441 | blk_end = pg_end << PAGE_CACHE_SHIFT; |