[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <n6cfp7kep2fue5qqka7unco2mufbprsahvklip3itt36pfb4dd@lap5hlskhyif>
Date: Tue, 25 Nov 2025 11:37:59 +0100
From: Jan Kara <jack@...e.cz>
To: libaokun@...weicloud.com
Cc: linux-ext4@...r.kernel.org, tytso@....edu, adilger.kernel@...ger.ca,
jack@...e.cz, linux-kernel@...r.kernel.org, yi.zhang@...wei.com,
yangerkun@...wei.com, libaokun1@...wei.com
Subject: Re: [PATCH e2fsprogs v3] libext2fs: fix orphan file size > kernel
limit with large blocksize
On Thu 20-11-25 21:55:14, libaokun@...weicloud.com wrote:
> From: Baokun Li <libaokun1@...wei.com>
>
> Kernel commit 0a6ce20c1564 ("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
>
> Thus, orphan file size is capped at 512 filesystem blocks in both e2fsprogs
> and the kernel.
>
> Signed-off-by: Baokun Li <libaokun1@...wei.com>
So finally we should have this consistent :). Thanks for working on this.
Feel free to add:
Reviewed-by: Jan Kara <jack@...e.cz>
Honza
> ---
> v1->v2:
> * Revert the changes in ext2fs_default_orphan_file_blocks()
>
> v2->v3:
> * Aligning with the old default of 512 filesystem blocks for
> max orphan file size allows existing 64KB block filesystems
> (created under 64KB page size) to mount without error.
>
> v1: https://lore.kernel.org/r/20251112122157.1990595-1-libaokun@huaweicloud.com
> v2: https://lore.kernel.org/r/20251113090122.2385797-1-libaokun@huaweicloud.com
>
> lib/ext2fs/orphan.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/lib/ext2fs/orphan.c b/lib/ext2fs/orphan.c
> index 14ac3569..0f1889cb 100644
> --- a/lib/ext2fs/orphan.c
> +++ b/lib/ext2fs/orphan.c
> @@ -15,6 +15,8 @@
> #include "ext2_fs.h"
> #include "ext2fsP.h"
>
> +#define EXT4_MAX_ORPHAN_FILE_BLOCKS 512
> +
> errcode_t ext2fs_truncate_orphan_file(ext2_filsys fs)
> {
> struct ext2_inode inode;
> @@ -129,6 +131,9 @@ errcode_t ext2fs_create_orphan_file(ext2_filsys fs, blk_t num_blocks)
> struct ext4_orphan_block_tail *ob_tail;
> time_t now;
>
> + if (num_blocks > EXT4_MAX_ORPHAN_FILE_BLOCKS)
> + num_blocks = EXT4_MAX_ORPHAN_FILE_BLOCKS;
> +
> if (ino) {
> err = ext2fs_read_inode(fs, ino, &inode);
> if (err)
> --
> 2.46.1
>
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists