[PATCH] erofs: fix unsupported blksize in fileio mode

Hongzhen Luo posted 1 patch 1 month, 1 week ago
fs/erofs/super.c | 4 ++++
1 file changed, 4 insertions(+)
[PATCH] erofs: fix unsupported blksize in fileio mode
Posted by Hongzhen Luo 1 month, 1 week ago
In fileio mode, when blcksize is not equal to PAGE_SIZE,
erofs will attempt to set the block size of sb->s_bdev,
which will trigger a panic. This patch fixes this.

Fixes: fb176750266a ("erofs: add file-backed mount support")

Signed-off-by: Hongzhen Luo <hongzhen@linux.alibaba.com>
---
 fs/erofs/super.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/erofs/super.c b/fs/erofs/super.c
index 320d586c3896..a7635e667d4b 100644
--- a/fs/erofs/super.c
+++ b/fs/erofs/super.c
@@ -631,6 +631,10 @@ static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc)
 			errorfc(fc, "unsupported blksize for fscache mode");
 			return -EINVAL;
 		}
+		if (erofs_is_fileio_mode(sbi)) {
+			errorfc(fc, "unsupported blksize for fileio mode");
+			return -EINVAL;
+		}
 		if (!sb_set_blocksize(sb, 1 << sbi->blkszbits)) {
 			errorfc(fc, "failed to set erofs blksize");
 			return -EINVAL;
-- 
2.43.5
Re: [PATCH] erofs: fix unsupported blksize in fileio mode
Posted by Gao Xiang 1 month, 1 week ago
Hi Hongzhen,

On 2024/10/15 11:36, Hongzhen Luo wrote:
> In fileio mode, when blcksize is not equal to PAGE_SIZE,
> erofs will attempt to set the block size of sb->s_bdev,
> which will trigger a panic. This patch fixes this.
> 
> Fixes: fb176750266a ("erofs: add file-backed mount support")
> 
> Signed-off-by: Hongzhen Luo <hongzhen@linux.alibaba.com>

File-backed mounts should support < PAGE_SIZE sizes.
You should just fix these cases instead.

Thanks,
Gao Xiang
Re: [PATCH] erofs: fix unsupported blksize in fileio mode
Posted by Hongzhen Luo 1 month, 1 week ago
On 2024/10/15 11:47, Gao Xiang wrote:
> Hi Hongzhen,
>
> On 2024/10/15 11:36, Hongzhen Luo wrote:
>> In fileio mode, when blcksize is not equal to PAGE_SIZE,
>> erofs will attempt to set the block size of sb->s_bdev,
>> which will trigger a panic. This patch fixes this.
>>
>> Fixes: fb176750266a ("erofs: add file-backed mount support")
>>
>> Signed-off-by: Hongzhen Luo <hongzhen@linux.alibaba.com>
>
> File-backed mounts should support < PAGE_SIZE sizes.
> You should just fix these cases instead.
>
> Thanks,
> Gao Xiang


Okay, I will fix it later.

---

Thanks,

Hongzhen