Skip to content

Commit 7c11c56

Browse files
LiBaokun96tytso
authored andcommitted
ext4: align max orphan file size with e2fsprogs limit
Kernel commit 0a6ce20 ("ext4: verify orphan file size is not too big") limits the maximum supported orphan file size to 8 << 20. However, in e2fsprogs, the orphan file size is set to 32–512 filesystem blocks when creating a filesystem. With 64k block size, formatting an ext4 fs >32G gives an orphan file bigger than the kernel allows, so mount prints an error and fails: EXT4-fs (vdb): orphan file too big: 8650752 EXT4-fs (vdb): mount failed To prevent this issue and allow previously created 64KB filesystems to mount, we updates the maximum allowed orphan file size in the kernel to 512 filesystem blocks. Fixes: 0a6ce20 ("ext4: verify orphan file size is not too big") Signed-off-by: Baokun Li <libaokun1@huawei.com> Reviewed-by: Jan Kara <jack@suse.cz> Message-ID: <20251120134233.2994147-1-libaokun@huaweicloud.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Cc: stable@kernel.org
1 parent 39fc6d4 commit 7c11c56

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

fs/ext4/orphan.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#include "ext4.h"
99
#include "ext4_jbd2.h"
1010

11+
#define EXT4_MAX_ORPHAN_FILE_BLOCKS 512
12+
1113
static int ext4_orphan_file_add(handle_t *handle, struct inode *inode)
1214
{
1315
int i, j, start;
@@ -588,7 +590,7 @@ int ext4_init_orphan_info(struct super_block *sb)
588590
* consuming absurd amounts of memory when pinning blocks of orphan
589591
* file in memory.
590592
*/
591-
if (inode->i_size > 8 << 20) {
593+
if (inode->i_size > (EXT4_MAX_ORPHAN_FILE_BLOCKS << inode->i_blkbits)) {
592594
ext4_msg(sb, KERN_ERR, "orphan file too big: %llu",
593595
(unsigned long long)inode->i_size);
594596
ret = -EFSCORRUPTED;

0 commit comments

Comments
 (0)