]> git.baikalelectronics.ru Git - kernel.git/commit
f2fs: should put a page beyond EOF when preparing a write
authorJaegeuk Kim <jaegeuk@kernel.org>
Mon, 30 Aug 2021 20:30:45 +0000 (13:30 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 31 Aug 2021 21:39:39 +0000 (14:39 -0700)
commit1b31dc75774f1f0aebbb2ea88f97f743b89913b2
treec1a8812191b839f0e5a1daab2ce71ccb911bb1a9
parent221c89768acccbda17d90e65a41146a343561275
f2fs: should put a page beyond EOF when preparing a write

The prepare_compress_overwrite() gets/locks a page to prepare a read, and calls
f2fs_read_multi_pages() which checks EOF first. If there's any page beyond EOF,
we unlock the page and set cc->rpages[i] = NULL, which we can't put the page
anymore. This makes page leak, so let's fix by putting that page.

Fixes: 176f2bda2bcf ("f2fs: compress: fix race condition of overwrite vs truncate")
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/data.c