lkml.org 
[lkml]   [2021]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] ext4: call fallocate may cause process to hang when using fast commit
Date
If open a file with O_SYNC, and call fallocate with mode=0.when using
fast commit, will cause the process to hang.

During the fast_commit procedure, it will wait for inode update done.
call ext4_fc_stop_update() before ext4_fc_commit() to mark inode
complete update.

Signed-off-by: Xin Yin <yinxin.x@bytedance.com>
---
fs/ext4/extents.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 4108896d471b..92db33887b6c 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4707,8 +4707,12 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
goto out;

if (file->f_flags & O_SYNC && EXT4_SB(inode->i_sb)->s_journal) {
+ ext4_fc_stop_update(inode);
ret = ext4_fc_commit(EXT4_SB(inode->i_sb)->s_journal,
EXT4_I(inode)->i_sync_tid);
+ inode_unlock(inode);
+ trace_ext4_fallocate_exit(inode, offset, max_blocks, ret);
+ return ret;
}
out:
inode_unlock(inode);
--
2.20.1
\
 
 \ /
  Last update: 2021-12-16 09:04    [W:0.098 / U:3.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site