* [PATCH] f2fs: avoid infinite loop in f2fs_alloc_nid
@ 2018-09-19 22:47 Jaegeuk Kim
2018-09-20 6:09 ` [f2fs-dev] " Chao Yu
0 siblings, 1 reply; 2+ messages in thread
From: Jaegeuk Kim @ 2018-09-19 22:47 UTC (permalink / raw)
To: linux-kernel, linux-f2fs-devel; +Cc: Jaegeuk Kim
If we have an error in f2fs_build_free_nids, we're able to fall into a loop
to find free nids.
Suggested-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
fs/f2fs/node.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 79b6fee354f7..e24f8acbea82 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -2356,8 +2356,9 @@ bool f2fs_alloc_nid(struct f2fs_sb_info *sbi, nid_t *nid)
spin_unlock(&nm_i->nid_list_lock);
/* Let's scan nat pages and its caches to get free nids */
- f2fs_build_free_nids(sbi, true, false);
- goto retry;
+ if (!f2fs_build_free_nids(sbi, true, false))
+ goto retry;
+ return false;
}
/*
--
2.17.0.441.gb46fe60e1d-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: avoid infinite loop in f2fs_alloc_nid
2018-09-19 22:47 [PATCH] f2fs: avoid infinite loop in f2fs_alloc_nid Jaegeuk Kim
@ 2018-09-20 6:09 ` Chao Yu
0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2018-09-20 6:09 UTC (permalink / raw)
To: Jaegeuk Kim, linux-kernel, linux-f2fs-devel
On 2018/9/20 6:47, Jaegeuk Kim wrote:
> If we have an error in f2fs_build_free_nids, we're able to fall into a loop
> to find free nids.
>
> Suggested-by: Chao Yu <chao@kernel.org>
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Thanks,
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-09-20 6:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-19 22:47 [PATCH] f2fs: avoid infinite loop in f2fs_alloc_nid Jaegeuk Kim
2018-09-20 6:09 ` [f2fs-dev] " Chao Yu
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).