forked from luck/tmp_suning_uos_patched
f2fs: fix to avoid potential deadlock
We should always check F2FS_I(inode)->cp_task condition in prior to other
conditions in __should_serialize_io() to avoid deadloop described in
commit 040d2bb318
("f2fs: fix to avoid deadloop if data_flush is on"),
however we break this rule when we support compression, fix it.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
9995e40126
commit
b13f67ffe3
|
@ -2962,15 +2962,17 @@ static int f2fs_write_cache_pages(struct address_space *mapping,
|
||||||
static inline bool __should_serialize_io(struct inode *inode,
|
static inline bool __should_serialize_io(struct inode *inode,
|
||||||
struct writeback_control *wbc)
|
struct writeback_control *wbc)
|
||||||
{
|
{
|
||||||
if (!S_ISREG(inode->i_mode))
|
|
||||||
return false;
|
|
||||||
if (f2fs_compressed_file(inode))
|
|
||||||
return true;
|
|
||||||
if (IS_NOQUOTA(inode))
|
|
||||||
return false;
|
|
||||||
/* to avoid deadlock in path of data flush */
|
/* to avoid deadlock in path of data flush */
|
||||||
if (F2FS_I(inode)->cp_task)
|
if (F2FS_I(inode)->cp_task)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (!S_ISREG(inode->i_mode))
|
||||||
|
return false;
|
||||||
|
if (IS_NOQUOTA(inode))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (f2fs_compressed_file(inode))
|
||||||
|
return true;
|
||||||
if (wbc->sync_mode != WB_SYNC_ALL)
|
if (wbc->sync_mode != WB_SYNC_ALL)
|
||||||
return true;
|
return true;
|
||||||
if (get_dirty_pages(inode) >= SM_I(F2FS_I_SB(inode))->min_seq_blocks)
|
if (get_dirty_pages(inode) >= SM_I(F2FS_I_SB(inode))->min_seq_blocks)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user