Skip to content

Commit bae0854

Browse files
salvetehsiangkao
authored andcommitted
erofs: fix blksize < PAGE_SIZE for file-backed mounts
Adjust sb->s_blocksize{,_bits} directly for file-backed mounts when the fs block size is smaller than PAGE_SIZE. Previously, EROFS used sb_set_blocksize(), which caused a panic if bdev-backed mounts is not used. Fixes: fb17675 ("erofs: add file-backed mount support") Signed-off-by: Hongzhen Luo <hongzhen@linux.alibaba.com> Link: https://lore.kernel.org/r/20241015103836.3757438-1-hongzhen@linux.alibaba.com Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
1 parent ec4f59d commit bae0854

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fs/erofs/super.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,11 @@ static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc)
616616
errorfc(fc, "unsupported blksize for fscache mode");
617617
return -EINVAL;
618618
}
619-
if (!sb_set_blocksize(sb, 1 << sbi->blkszbits)) {
619+
620+
if (erofs_is_fileio_mode(sbi)) {
621+
sb->s_blocksize = 1 << sbi->blkszbits;
622+
sb->s_blocksize_bits = sbi->blkszbits;
623+
} else if (!sb_set_blocksize(sb, 1 << sbi->blkszbits)) {
620624
errorfc(fc, "failed to set erofs blksize");
621625
return -EINVAL;
622626
}

0 commit comments

Comments
 (0)