]> git.baikalelectronics.ru Git - kernel.git/commit
f2fs: fix a race condition in next_free_nid
authorHuang Ying <ying.huang@intel.com>
Fri, 12 Sep 2014 11:21:11 +0000 (19:21 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 16 Sep 2014 11:10:46 +0000 (04:10 -0700)
commit31ae21b6ac1e133466f40004fb9c8346501f8963
tree11e5615fa53e993dd997556e839ba8014a350af1
parent6bd7d80f6cb8ac134507ec9ba036016db3143296
f2fs: fix a race condition in next_free_nid

The nm_i->fcnt checking is executed before spin_lock, so if another
thread delete the last free_nid from the list, the wrong nid may be
gotten.  So fix the race condition by moving the nm_i->fnct checking
into spin_lock.

Signed-off-by: Huang, Ying <ying.huang@intel.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/node.h