Re: [PATCH 10/10] omfs: handle set_blocksize failures

Christian Brauner <[email protected]> Mon, 11 May 2026 15:40:53 +0200
Newsgroups dev.linux.lists.ntfs3,org.kernel.vger.linux-fsdevel
Message-ID <20260511-angst-essgewohnheiten-253295fac18c@brauner>
On Mon, May 11, 2026 at 09:16:55AM +0200, Christoph Hellwig wrote:
> omfs uses buffer_heads, which don't handle block size > PAGE_SIZE well.
> Without this, mounting we will hit the
> 
>         BUG_ON(offset >= folio_size(folio));
> 
> in folio_set_bh on the first __bread_gfp call.
> 
> Signed-off-by: Christoph Hellwig <[email protected]>
> 
> Signed-off-by: Christoph Hellwig <[email protected]>

I'll drop the double-sign-off.

> ---
>  fs/omfs/inode.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/omfs/inode.c b/fs/omfs/inode.c
> index 834cae1e6223..1d915ef72119 100644
> --- a/fs/omfs/inode.c
> +++ b/fs/omfs/inode.c
> @@ -478,7 +478,8 @@ static int omfs_fill_super(struct super_block *sb, struct fs_context *fc)
>  	sb->s_time_min = 0;
>  	sb->s_time_max = U64_MAX / MSEC_PER_SEC;
>  
> -	sb_set_blocksize(sb, 0x200);
> +	if (!sb_set_blocksize(sb, 0x200))
> +		goto end;
>  
>  	bh = sb_bread(sb, 0);
>  	if (!bh)
> @@ -530,7 +531,8 @@ static int omfs_fill_super(struct super_block *sb, struct fs_context *fc)
>  	 * Use sys_blocksize as the fs block since it is smaller than a
>  	 * page while the fs blocksize can be larger.
>  	 */
> -	sb_set_blocksize(sb, sbi->s_sys_blocksize);
> +	if (!sb_set_blocksize(sb, sbi->s_sys_blocksize))
> +		goto out_brelse_bh;
>  
>  	/*
>  	 * ...and the difference goes into a shift.  sys_blocksize is always
> -- 
> 2.53.0
>