diff options
| author | Chen Changcheng <chenchangcheng@kylinos.cn> | 2026-08-04 08:54:02 +0800 |
|---|---|---|
| committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2026-08-05 01:30:52 +0000 |
| commit | 0f9af07ecc1ab486038373db6ae0436c5d674b19 (patch) | |
| tree | 408460b44fb57255d33d21c1c1ec0e0dbd5b4195 /tools/perf/scripts/python | |
| parent | 8e4692c6c165e81b2cbb847d8da4b45a53483b33 (diff) | |
f2fs: fix valid block count leak on data block allocation failure
In __allocate_data_block(), when allocating a new data block
(dn->data_blkaddr == NULL_ADDR), inc_valid_block_count() is
called first to increment total_valid_block_count and i_blocks.
If the subsequent f2fs_allocate_data_block() fails, the function
returns the error directly without rolling back the
already-incremented block counts, causing a permanent leak.
Fix this by calling dec_valid_block_count() to undo the
increment before returning the error. The condition
old_blkaddr == NULL_ADDR precisely identifies the case where
inc_valid_block_count() was called.
Fixes: 7d009e048d7c ("f2fs: fix to handle segment allocation failure correctly")
Cc: <stable@vger.kernel.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Chen Changcheng <chenchangcheng@kylinos.cn>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
