summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHongzhen Luo <hongzhen@linux.alibaba.com>2024-10-15 18:38:36 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-12-05 14:02:00 +0100
commit679d8537e5748241c71ac97a6b6dc919eae31716 (patch)
treec9880f0162861880d58b8f780ae7386f91cbeac6
parent5036f2f024cac40a02ea6ea70de2c3a4407d16bc (diff)
erofs: fix blksize < PAGE_SIZE for file-backed mounts
[ Upstream commit bae0854160939a64a092516ff1b2f221402b843b ] 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 <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> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--fs/erofs/super.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/erofs/super.c b/fs/erofs/super.c
index bed3dbe5b7cb..2dd7d819572f 100644
--- a/fs/erofs/super.c
+++ b/fs/erofs/super.c
@@ -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;
}