erofs: fix blksize < PAGE_SIZE for file-backed mounts
PATCH v4 1/1 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 fb176750266a ("erofs: add file-backed mount support")
Signed-off-by Hongzhen Luo <[email protected]>
---
v4: Remove unnecessary parentheses.
v3: https://lore.kernel.org/all/[email protected]/
v2: https://lore.kernel.org/linux-erofs/[email protected]/
v1: https://lore.kernel.org/linux-erofs/[email protected]/
--- fs/erofs/super.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/erofs/super.c +5 -1
@@ -631,7 +631,11 @@ static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc)errorfc (fc,"unsupported blksize for fscache mode" );return -EINVAL ; } -if (!sb_set_blocksize (sb,1 << sbi->blkszbits)) { + +if (erofs_is_fileio_mode (sbi)) { + sb->s_blocksize =1 << sbi->blkszbits; + sb->s_blocksize_bits = sbi->blkszbits; + }else if (!sb_set_blocksize (sb,1 << sbi->blkszbits)) {errorfc (fc,"failed to set erofs blksize" );return -EINVAL ; }
Signature · 1 line
2.43.5