LiFan 5921aaa185 f2fs: fix concurrent problem for updating free bitmap
alloc_nid_failed and scan_nat_page can be called at the same time,
and we haven't protected add_free_nid and update_free_nid_bitmap
with the same nid_list_lock. That could lead to

Thread A				Thread B
- __build_free_nids
 - scan_nat_page
  - add_free_nid
					- alloc_nid_failed
					 - update_free_nid_bitmap
  - update_free_nid_bitmap

scan_nat_page will clear the free bitmap since the nid is PREALLOC_NID,
but alloc_nid_failed needs to set the free bitmap. This results in
free nid with free bitmap cleared.
This patch update the bitmap under the same nid_list_lock in add_free_nid.
And use __GFP_NOFAIL to make sure to update status of free nid correctly.

Signed-off-by: Fan li <fanofcode.li@samsung.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2018-01-02 19:27:27 -08:00
..
2017-12-10 08:30:04 -08:00
2017-11-15 18:21:06 -08:00
2017-12-17 12:20:58 -08:00
2017-08-24 13:23:03 -07:00
2017-11-14 14:44:04 -08:00
2017-11-16 11:41:22 -08:00
2017-11-17 09:51:57 -08:00
2017-11-27 16:45:11 -05:00
2017-12-16 13:12:53 -08:00
2017-12-13 20:15:49 -08:00
2017-09-04 19:05:15 -04:00
2017-11-15 18:21:04 -08:00
2017-12-09 20:16:33 -05:00