Skip to contentSkip to conversation

erofs: fix unsupported blksize in fileio mode

PATCH Superseded Hongzhen Luo 2 participants 3 messages Oct 15, 2024 EROFS file system

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 erofs: fix unsupported blksize in fileio mode

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")
---
 fs/erofs/super.c | 4 ++++
 1 file changed, 4 insertions(+)
fs/erofs/super.c +4 -0
index 320d586c3896..a7635e667d4b 100644
@@ -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;
Signature · 1 line
2.43.5
#1 lore raw

Hi Hongzhen,

Quoted 7 lines · Hongzhen Luo

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")

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

Thanks,
Gao Xiang

#2 lore raw
Quoted 9 lines · Gao Xiang

Hi Hongzhen,

Quoted 6 lines · Hongzhen Luo

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")
Quoted 7 lines
Quoted 1 line

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