f2fs: call radix_tree_preload before radix_tree_insert
authorJaegeuk Kim <jaegeuk@kernel.org>
Thu, 4 Dec 2014 04:47:26 +0000 (20:47 -0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Fri, 5 Dec 2014 17:51:04 +0000 (09:51 -0800)
commit769ec6e5b7d4a8115447736871be8bffaaba3a7d
tree94e1062ffee03b4dc980da82c2da4ec06916b997
parent8b26ef98da3387eb57a8a5c1747c6e628948ee0c
f2fs: call radix_tree_preload before radix_tree_insert

This patch tries to fix:

 BUG: using smp_processor_id() in preemptible [00000000] code: f2fs_gc-254:0/384
  (radix_tree_node_alloc+0x14/0x74) from [<c033d8a0>] (radix_tree_insert+0x110/0x200)
  (radix_tree_insert+0x110/0x200) from [<c02e8264>] (gc_data_segment+0x340/0x52c)
  (gc_data_segment+0x340/0x52c) from [<c02e8658>] (f2fs_gc+0x208/0x400)
  (f2fs_gc+0x208/0x400) from [<c02e8a98>] (gc_thread_func+0x248/0x28c)
  (gc_thread_func+0x248/0x28c) from [<c0139944>] (kthread+0xa0/0xac)
  (kthread+0xa0/0xac) from [<c0105ef8>] (ret_from_fork+0x14/0x3c)

The reason is that f2fs calls radix_tree_insert under enabled preemption.
So, before calling it, we need to call radix_tree_preload.

Otherwise, we should use _GFP_WAIT for the radix tree, and use mutex or
semaphore to cover the radix tree operations.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/checkpoint.c
fs/f2fs/gc.c
fs/f2fs/node.c