summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorshifei10.ge <shifei10.ge@samsung.com>2013-10-29 15:32:34 +0800
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2014-01-06 16:42:21 +0900
commita225dca39495f7c18f1210306281c9c41a3454f6 (patch)
tree838aa3ffe74b4a76ed834a7ef969a1e76be41433 /kernel
parenta8865372a8414298982e07f4ac8d6dc0ab1e0a3d (diff)
downloadblackbird-op-linux-a225dca39495f7c18f1210306281c9c41a3454f6.tar.gz
blackbird-op-linux-a225dca39495f7c18f1210306281c9c41a3454f6.zip
f2fs: fix truncate_partial_nodes bug
The truncate_partial_nodes puts pages incorrectly in the following two cases. Note that the value for argc 'depth' can only be 2 or 3. Please see truncate_inode_blocks() and truncate_partial_nodes(). 1) An err is occurred in the first 'for' loop When err is occurred with depth = 2, pages[0] is invalid, so this page doesn't need to be put. There is no problem, however, when depth is 3, it doesn't put the pages correctly where pages[0] is valid and pages[1] is invalid. In this case, depth is set to 2 (ref to statemnt depth = i + 1), and then 'goto fail'. In label 'fail', for (i = depth - 3; i >= 0; i--) cannot meet the condition because i = -1, so pages[0] cann't be put. 2) An err happened in the second 'for' loop Now we've got pages[0] with depth = 2, or we've got pages[0] and pages[1] with depth = 3. When an err is detected, we need 'goto fail' to put such the pages. When depth is 2, in label 'fail', for (i = depth - 3; i >= 0; i--) cann't meet the condition because i = -1, so pages[0] cann't be put. When depth is 3, in label 'fail', for (i = depth - 3; i >= 0; i--) can only put pages[0], pages[1] also cann't be put. Note that 'depth' has been changed before first 'goto fail' (ref to statemnt depth = i + 1), so passing this modified 'depth' to the tracepoint, trace_f2fs_truncate_partial_nodes, is also incorrect. Signed-off-by: Shifei Ge <shifei10.ge@samsung.com> [Jaegeuk Kim: modify the description and fix one bug] Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'kernel')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud