[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250113163345.GO1284777@mit.edu>
Date: Mon, 13 Jan 2025 11:33:45 -0500
From: "Theodore Ts'o" <tytso@....edu>
To: Catalin Patulea <cronos586@...il.com>
Cc: linux-ext4@...r.kernel.org, Kazuya Mio <k-mio@...jp.nec.com>
Subject: Re: e2fsck max blocks for huge non-extent file
On Mon, Jan 13, 2025 at 12:49:19AM -0500, Catalin Patulea wrote:
>
> I have an ext3 filesystem on which I manually enabled huge_file
> (files >2 TB) using tune2fs; then created a 3 TB file (backup image
> of another disk). Now, I am running e2fsck and it reports errors:
Hmm, it looks like this has been broken for a while. I've done a
quick look, and it appears this has been the case since e2fsprogs
1.28 and this commit:
commit da307041e75bdf3b24c1eb43132a4f9d8a1b3844
Author: Theodore Ts'o <tytso@....edu>
Date: Tue May 21 21:19:14 2002 -0400
Check for inodes which are too big (either too many blocks, or
would cause i_size to be too big), and offer to truncate the inode.
Remove old bogus i_size checks.
Add test case which tests e2fsck's handling of large sparse files.
Older e2fsck with the old(er) bogus i_size checks didn't handle
this correctly.
I think no one noticed since trying to support files this large on a
non-extent file is so inefficient and painful that in practice anyone
trying to use files this large would be using ext4, and not a really
ancient ext3 file system.
The fix might be as simple as this, but I haven't had a chance to test
it and do appropriate regression tests....
diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index eb73922d3..e460a75f4 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -3842,7 +3842,7 @@ static int process_block(ext2_filsys fs,
problem = PR_1_TOOBIG_DIR;
if (p->is_dir && p->num_blocks + 1 >= p->max_blocks)
problem = PR_1_TOOBIG_DIR;
- if (p->is_reg && p->num_blocks + 1 >= p->max_blocks)
+ if (p->is_reg && p->num_blocks + 1 >= 1U << 31)
problem = PR_1_TOOBIG_REG;
if (!p->is_dir && !p->is_reg && blockcnt > 0)
problem = PR_1_TOOBIG_SYMLINK;
- Ted
Powered by blists - more mailing lists