f2fs: fix to align to section for fallocate() on pinned file
authorChao Yu <yuchao0@huawei.com>
Fri, 5 Mar 2021 09:56:01 +0000 (17:56 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 May 2021 08:13:01 +0000 (10:13 +0200)
commit74d2b0e74c3f5bccfe71e3466356f4a08a0bc73e
tree1516d2eb17153114b168ff262e7d0181bdf8cb2b
parent630146203108bf6b8934eec0dfdb3e46dcb917de
f2fs: fix to align to section for fallocate() on pinned file

[ Upstream commit e1175f02291141bbd924fc578299305fcde35855 ]

Now, fallocate() on a pinned file only allocates blocks which aligns
to segment rather than section, so GC may try to migrate pinned file's
block, and after several times of failure, pinned file's block could
be migrated to other place, however user won't be aware of such
condition, and then old obsolete block address may be readed/written
incorrectly.

To avoid such condition, let's try to allocate pinned file's blocks
with section alignment.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/f2fs/f2fs.h
fs/f2fs/file.c
fs/f2fs/segment.c