Skip to content

Commit 4db08d0

Browse files
author
Jaegeuk Kim
committed
f2fs: avoid cpu lockup
Before retrying to flush data or dentry pages, we need to release cpu in order to prevent watchdog. Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent 299aa41 commit 4db08d0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

fs/f2fs/checkpoint.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -879,6 +879,7 @@ int sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type)
879879
struct inode *inode;
880880
struct f2fs_inode_info *fi;
881881
bool is_dir = (type == DIR_INODE);
882+
unsigned long ino = 0;
882883

883884
trace_f2fs_sync_dirty_inodes_enter(sbi->sb, is_dir,
884885
get_pages(sbi, is_dir ?
@@ -901,8 +902,17 @@ int sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type)
901902
inode = igrab(&fi->vfs_inode);
902903
spin_unlock(&sbi->inode_lock[type]);
903904
if (inode) {
905+
unsigned long cur_ino = inode->i_ino;
906+
904907
filemap_fdatawrite(inode->i_mapping);
905908
iput(inode);
909+
/* We need to give cpu to another writers. */
910+
if (ino == cur_ino) {
911+
congestion_wait(BLK_RW_ASYNC, HZ/50);
912+
cond_resched();
913+
} else {
914+
ino = cur_ino;
915+
}
906916
} else {
907917
/*
908918
* We should submit bio, since it exists several

0 commit comments

Comments
 (0)