* [PATCH] f2fs: avoid endless loop in funtion f2fs_sync_inode_meta
@ 2017-11-07 2:23 Yunlei He
2017-11-07 2:54 ` Jaegeuk Kim
0 siblings, 1 reply; 2+ messages in thread
From: Yunlei He @ 2017-11-07 2:23 UTC (permalink / raw)
To: jaegeuk, yuchao0, linux-f2fs-devel; +Cc: ning.jia, heyunlei
One inode may be evicted without removing from global dirty list,
which will cause endless loop in funtion f2fs_sync_inode_meta.
Signed-off-by: Yunlei He <heyunlei@huawei.com>
---
fs/f2fs/inode.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
index 9684d535..ce1f87d 100644
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -532,6 +532,13 @@ void f2fs_evict_inode(struct inode *inode)
if (err)
update_inode_page(inode);
+
+ if (unlikely(is_inode_flag_set(inode, FI_DIRTY_INODE))) {
+ f2fs_inode_synced(inode);
+ f2fs_msg(sbi->sb, KERN_WARNING, "correct inode status to avoid "
+ "endless loop, since inode writeback flow is broken");
+ f2fs_bug_on(sbi, 1);
+ }
dquot_free_inode(inode);
sb_end_intwrite(inode->i_sb);
no_delete:
@@ -541,6 +548,19 @@ void f2fs_evict_inode(struct inode *inode)
stat_dec_inline_dir(inode);
stat_dec_inline_inode(inode);
+ if (unlikely(is_inode_flag_set(inode, FI_DIRTY_INODE))) {
+ sb_start_intwrite(inode->i_sb);
+ update_inode_page(inode);
+ if (is_inode_flag_set(inode, FI_DIRTY_INODE)) {
+ f2fs_inode_synced(inode);
+ f2fs_msg(sbi->sb, KERN_WARNING,
+ "inode info is inconsistent since "
+ "inode evicts before we writeback it");
+ }
+ sb_end_intwrite(inode->i_sb);
+ f2fs_bug_on(sbi, 1);
+ }
+
if (likely(!is_set_ckpt_flags(sbi, CP_ERROR_FLAG)))
f2fs_bug_on(sbi, is_inode_flag_set(inode, FI_DIRTY_INODE));
else
--
1.9.1
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] f2fs: avoid endless loop in funtion f2fs_sync_inode_meta
2017-11-07 2:23 [PATCH] f2fs: avoid endless loop in funtion f2fs_sync_inode_meta Yunlei He
@ 2017-11-07 2:54 ` Jaegeuk Kim
0 siblings, 0 replies; 2+ messages in thread
From: Jaegeuk Kim @ 2017-11-07 2:54 UTC (permalink / raw)
To: Yunlei He; +Cc: ning.jia, linux-f2fs-devel
On 11/07, Yunlei He wrote:
> One inode may be evicted without removing from global dirty list,
> which will cause endless loop in funtion f2fs_sync_inode_meta.
I think this was resolved by:
f2fs: avoid stale fi->gdirty_list pointer
Thanks,
>
> Signed-off-by: Yunlei He <heyunlei@huawei.com>
> ---
> fs/f2fs/inode.c | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
> index 9684d535..ce1f87d 100644
> --- a/fs/f2fs/inode.c
> +++ b/fs/f2fs/inode.c
> @@ -532,6 +532,13 @@ void f2fs_evict_inode(struct inode *inode)
>
> if (err)
> update_inode_page(inode);
> +
> + if (unlikely(is_inode_flag_set(inode, FI_DIRTY_INODE))) {
> + f2fs_inode_synced(inode);
> + f2fs_msg(sbi->sb, KERN_WARNING, "correct inode status to avoid "
> + "endless loop, since inode writeback flow is broken");
> + f2fs_bug_on(sbi, 1);
> + }
> dquot_free_inode(inode);
> sb_end_intwrite(inode->i_sb);
> no_delete:
> @@ -541,6 +548,19 @@ void f2fs_evict_inode(struct inode *inode)
> stat_dec_inline_dir(inode);
> stat_dec_inline_inode(inode);
>
> + if (unlikely(is_inode_flag_set(inode, FI_DIRTY_INODE))) {
> + sb_start_intwrite(inode->i_sb);
> + update_inode_page(inode);
> + if (is_inode_flag_set(inode, FI_DIRTY_INODE)) {
> + f2fs_inode_synced(inode);
> + f2fs_msg(sbi->sb, KERN_WARNING,
> + "inode info is inconsistent since "
> + "inode evicts before we writeback it");
> + }
> + sb_end_intwrite(inode->i_sb);
> + f2fs_bug_on(sbi, 1);
> + }
> +
> if (likely(!is_set_ckpt_flags(sbi, CP_ERROR_FLAG)))
> f2fs_bug_on(sbi, is_inode_flag_set(inode, FI_DIRTY_INODE));
> else
> --
> 1.9.1
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-11-07 2:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-07 2:23 [PATCH] f2fs: avoid endless loop in funtion f2fs_sync_inode_meta Yunlei He
2017-11-07 2:54 ` Jaegeuk Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).