Commit 4db08d01 authored by Jaegeuk Kim's avatar Jaegeuk Kim

f2fs: avoid cpu lockup

Before retrying to flush data or dentry pages, we need to release cpu in order
to prevent watchdog.
Reviewed-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 299aa41a
...@@ -879,6 +879,7 @@ int sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type) ...@@ -879,6 +879,7 @@ int sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type)
struct inode *inode; struct inode *inode;
struct f2fs_inode_info *fi; struct f2fs_inode_info *fi;
bool is_dir = (type == DIR_INODE); bool is_dir = (type == DIR_INODE);
unsigned long ino = 0;
trace_f2fs_sync_dirty_inodes_enter(sbi->sb, is_dir, trace_f2fs_sync_dirty_inodes_enter(sbi->sb, is_dir,
get_pages(sbi, is_dir ? get_pages(sbi, is_dir ?
...@@ -901,8 +902,17 @@ int sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type) ...@@ -901,8 +902,17 @@ int sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type)
inode = igrab(&fi->vfs_inode); inode = igrab(&fi->vfs_inode);
spin_unlock(&sbi->inode_lock[type]); spin_unlock(&sbi->inode_lock[type]);
if (inode) { if (inode) {
unsigned long cur_ino = inode->i_ino;
filemap_fdatawrite(inode->i_mapping); filemap_fdatawrite(inode->i_mapping);
iput(inode); iput(inode);
/* We need to give cpu to another writers. */
if (ino == cur_ino) {
congestion_wait(BLK_RW_ASYNC, HZ/50);
cond_resched();
} else {
ino = cur_ino;
}
} else { } else {
/* /*
* We should submit bio, since it exists several * We should submit bio, since it exists several
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment