linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] f2fs: Restrict max filesize for 16K f2fs
@ 2023-12-05  2:38 Daniel Rosenberg
  2023-12-14 20:50 ` [f2fs-dev] " patchwork-bot+f2fs
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Rosenberg @ 2023-12-05  2:38 UTC (permalink / raw)
  To: linux-f2fs-devel
  Cc: Jaegeuk Kim, Chao Yu, linux-kernel, kernel-team, Daniel Rosenberg

Blocks are tracked by u32, so the max permitted filesize is
(U32_MAX + 1) * BLOCK_SIZE. Additionally, in order to support crypto
data unit sizes of 4K with a 16K block with IV_INO_LBLK_{32,64}, we must
further restrict max filesize to (U32_MAX + 1) * 4096. This does not
affect 4K blocksize f2fs as the natural limit for files are well below
that.

Fixes: d7e9a9037de2 ("f2fs: Support Block Size == Page Size")
Signed-off-by: Daniel Rosenberg <drosen@google.com>
---
 fs/f2fs/super.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 033af907c3b1..5dfbc6b4c0ac 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -3364,6 +3364,14 @@ loff_t max_file_blocks(struct inode *inode)
 	leaf_count *= NIDS_PER_BLOCK;
 	result += leaf_count;
 
+	/*
+	 * For compatibility with FSCRYPT_POLICY_FLAG_IV_INO_LBLK_{64,32} with
+	 * a 4K crypto data unit, we must restrict the max filesize to what can
+	 * fit within U32_MAX + 1 data units.
+	 */
+
+	result = min(result, (((loff_t)U32_MAX + 1) * 4096) >> F2FS_BLKSIZE_BITS);
+
 	return result;
 }
 

base-commit: d346fa09abff46988de9267b67b6900d9913d5a2
-- 
2.43.0.rc2.451.g8631bc7472-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [f2fs-dev] [PATCH v3] f2fs: Restrict max filesize for 16K f2fs
  2023-12-05  2:38 [PATCH v3] f2fs: Restrict max filesize for 16K f2fs Daniel Rosenberg
@ 2023-12-14 20:50 ` patchwork-bot+f2fs
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+f2fs @ 2023-12-14 20:50 UTC (permalink / raw)
  To: Daniel Rosenberg; +Cc: linux-f2fs-devel, jaegeuk, kernel-team, linux-kernel

Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <jaegeuk@kernel.org>:

On Mon,  4 Dec 2023 18:38:01 -0800 you wrote:
> Blocks are tracked by u32, so the max permitted filesize is
> (U32_MAX + 1) * BLOCK_SIZE. Additionally, in order to support crypto
> data unit sizes of 4K with a 16K block with IV_INO_LBLK_{32,64}, we must
> further restrict max filesize to (U32_MAX + 1) * 4096. This does not
> affect 4K blocksize f2fs as the natural limit for files are well below
> that.
> 
> [...]

Here is the summary with links:
  - [f2fs-dev,v3] f2fs: Restrict max filesize for 16K f2fs
    https://git.kernel.org/jaegeuk/f2fs/c/a6a010f5def5

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-12-14 20:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-05  2:38 [PATCH v3] f2fs: Restrict max filesize for 16K f2fs Daniel Rosenberg
2023-12-14 20:50 ` [f2fs-dev] " patchwork-bot+f2fs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).