summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/super.c
diff options
context:
space:
mode:
authorChao Yu <chao2.yu@samsung.com>2015-07-16 12:19:02 +0200
committerJaegeuk Kim <jaegeuk@kernel.org>2015-08-05 17:08:09 +0200
commit55f57d2c4259a9a4048cf4629a2c6ba53729188d (patch)
tree00308a663bd758c81f7c9bcc90d66b8dc7f52f0d /fs/f2fs/super.c
parentf2fs: reduce region of cp_rwsem covered in f2fs_do_collapse (diff)
downloadlinux-55f57d2c4259a9a4048cf4629a2c6ba53729188d.tar.xz
linux-55f57d2c4259a9a4048cf4629a2c6ba53729188d.zip
f2fs: fix double lock in handle_failed_inode
In handle_failed_inode, there is a potential deadlock which can happen in below call path: - f2fs_create - f2fs_lock_op down_read(cp_rwsem) - f2fs_add_link - __f2fs_add_link - init_inode_metadata - f2fs_init_security failed - truncate_blocks failed - handle_failed_inode - f2fs_truncate - truncate_blocks(..,true) - write_checkpoint - block_operations - f2fs_lock_all down_write(cp_rwsem) - f2fs_lock_op down_read(cp_rwsem) So in this path, we pass parameter to f2fs_truncate to make sure cp_rwsem in truncate_blocks will not be locked again. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to '')
-rw-r--r--fs/f2fs/super.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 0083b8559c9b..12eb69dd38af 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -467,7 +467,7 @@ static int f2fs_drop_inode(struct inode *inode)
i_size_write(inode, 0);
if (F2FS_HAS_BLOCKS(inode))
- f2fs_truncate(inode);
+ f2fs_truncate(inode, true);
sb_end_intwrite(inode->i_sb);