summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/node.c
diff options
context:
space:
mode:
authorJaegeuk Kim2018-09-20 00:45:19 +0200
committerJaegeuk Kim2018-09-20 23:49:19 +0200
commitf84262b0862d43b71b3e80a036cdd9d82e620367 (patch)
tree91b80a0b790b0ecc2c1fb3b815f6a7620907d213 /fs/f2fs/node.c
parentf2fs: add new idle interval timing for discard and gc paths (diff)
downloadkernel-qcow2-linux-f84262b0862d43b71b3e80a036cdd9d82e620367.tar.gz
kernel-qcow2-linux-f84262b0862d43b71b3e80a036cdd9d82e620367.tar.xz
kernel-qcow2-linux-f84262b0862d43b71b3e80a036cdd9d82e620367.zip
f2fs: avoid infinite loop in f2fs_alloc_nid
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> Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/node.c')
-rw-r--r--fs/f2fs/node.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index fa2381c0bc47..d62f53096b55 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -2350,8 +2350,9 @@ retry:
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;
}
/*