f2fs: exclude free nids building and allocation
authorChao Yu <yuchao0@huawei.com>
Tue, 11 Oct 2016 14:31:34 +0000 (22:31 +0800)
committerJaegeuk Kim <jaegeuk@google.com>
Mon, 25 Sep 2017 22:02:02 +0000 (15:02 -0700)
commit311aa690ef7bd32732a65d957c2490143c7b9830
tree29302624150c9f66074ac9ee1e1c75f950e15c27
parent6b266c3a9951abd948effac21d19ced0dee07dda
f2fs: exclude free nids building and allocation

commit 2411cf5befa5804e4ced4c45a3212d7653869286 upstream.

During nid allocation, it needs to exclude building and allocating flow
of free nids, this is because while building free nid cache, there are two
steps: a) load free nids from unused nat entries in NAT pages, b) update
free nid cache by checking nat journal. The two steps should be atomical,
otherwise an used nid can be allocated as free one after a) and before b).

This patch adds missing lock which covers build_free_nids in
unlock_operation and f2fs_balance_fs_bg to avoid that.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/node.c