f2fs: synchronize atomic write aborts
authorDaeho Jeong <daehojeong@google.com>
Thu, 9 Feb 2023 18:18:19 +0000 (10:18 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 11 Mar 2023 12:55:23 +0000 (13:55 +0100)
commit102b82708c1523b36d421cb8687746906069bc17
treef64379a58a56aa930803e46d17ae85383ffc9032
parenta02a91057652d98a1445808070ae5e968417741b
f2fs: synchronize atomic write aborts

[ Upstream commit a46bebd502fe1a3bd1d22f64cedd93e7e7702693 ]

To fix a race condition between atomic write aborts, I use the inode
lock and make COW inode to be re-usable thoroughout the whole
atomic file inode lifetime.

Reported-by: syzbot+823000d23b3400619f7c@syzkaller.appspotmail.com
Fixes: 3db1de0e582c ("f2fs: change the current atomic write way")
Signed-off-by: Daeho Jeong <daehojeong@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/f2fs/file.c
fs/f2fs/inode.c
fs/f2fs/segment.c
fs/f2fs/super.c