]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
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:29:37 +0000 (10:29 +0200)
commit0a0a6e69764e992069fc0d7570444ece9f048b8d
tree46566cdf14157c5e9caca356e8e633b81296c937
parent7eeacc6728c5478e3c01bc82a1f08958eaa12366
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