Skip to contentSkip to conversation

f2fs: fix to check return value of f2fs_do_truncate_blocks()

PATCH Applied Chao Yu 2 participants 2 messages Apr 5, 2023 – Apr 13, 2023 F2FS file system

lore
Share & tools
lore

Chao Yu

author maintainer
#0 lore raw

PATCH 1/1 f2fs: fix to check return value of f2fs_do_truncate_blocks()

Otherwise, if truncation on cow_inode failed, remained data may pollute current transaction of atomic write.

Cc Daeho Jeong <[email protected]>
Fixes a46bebd502fe ("f2fs: synchronize atomic write aborts")
---
 fs/f2fs/file.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
fs/f2fs/file.c +5 -1
index 10743e864d57..39c41c7e834b 100644
@@ -2113,7 +2113,11 @@ static int f2fs_ioc_start_atomic_write(struct file *filp, bool truncate)
 		clear_inode_flag(fi->cow_inode, FI_INLINE_DATA);
 	} else {
 		/* Reuse the already created COW inode */
-		f2fs_do_truncate_blocks(fi->cow_inode, 0, true);
+		ret = f2fs_do_truncate_blocks(fi->cow_inode, 0, true);
+		if (ret) {
+			f2fs_up_write(&fi->i_gc_rwsem[WRITE]);
+			goto out;
+		}
 	}
 
 	f2fs_write_inode(inode, NULL);
Signature · 8 lines
2.36.1



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
#1 lore raw
This patch was applied to jaegeuk/f2fs.git (dev) by Jaegeuk Kim <[email protected]>:

Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <[email protected]>:

Quoted 8 lines · On Wed, 5 Apr 2023 22:44:53 +0800 you wrote:

Otherwise, if truncation on cow_inode failed, remained data may pollute current transaction of atomic write.

Cc Daeho Jeong <[email protected]>
Fixes a46bebd502fe ("f2fs: synchronize atomic write aborts")

[...]

Here is the summary with links:
- [f2fs-dev] f2fs: fix to check return value of f2fs_do_truncate_blocks()

    https://git.kernel.org/jaegeuk/f2fs/c/b851ee6ba3cc

You are awesome, thank you!

Signature · 10 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel