Skip to contentSkip to conversation

erofs: leave compressed inodes unsupported in fscache mode for now

PATCH Superseded Jeffle Xu 2 participants 2 messages May 25, 2022 EROFS file system

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Jeffle Xu

author
#0 lore raw

PATCH 1/1 erofs: leave compressed inodes unsupported in fscache mode for now

erofs over fscache doesn't support the compressed layout yet. It will cause NULL crash if there are compressed inodes contained when working in fscache mode.

So far in the erofs based container image distribution scenarios (RAFS v6), the compressed images are downloaded to local and then decompressed as a erofs image of uncompressed layout. Then the erofs image is mounted in fscache mode and serves as the container image. Thus the current implementation won't break the container image distribution scenarios.

The fscache support for the compressed layout is still under development. Anyway, to avoid the potential crash, let's leave the compressed inodes unsupported in fscache mode until we support it later.

Fixes 1442b02b66ad ("erofs: implement fscache-based data read for non-inline layout")
---
 fs/erofs/inode.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
fs/erofs/inode.c +4 -1
index bcc8335b46b3..95a403720e8c 100644
@@ -288,7 +288,10 @@ static int erofs_fill_inode(struct inode *inode, int isdir)
 	}
 
 	if (erofs_inode_is_data_compressed(vi->datalayout)) {
-		err = z_erofs_fill_inode(inode);
+		if (!erofs_is_fscache_mode(inode->i_sb))
+			err = z_erofs_fill_inode(inode);
+		else
+			err = -EOPNOTSUPP;
 		goto out_unlock;
 	}
 	inode->i_mapping->a_ops = &erofs_raw_access_aops;
Signature · 1 line
2.27.0
Reviewed-by on v1 1/1
#1 lore raw

Hi Jeffle,

Quoted 6 lines · Jeffle Xu

erofs over fscache doesn't support the compressed layout yet. It will cause NULL crash if there are compressed inodes contained when working in fscache mode.

So far in the erofs based container image distribution scenarios (RAFS v6), the compressed images are downloaded to local and then

... the compressed RAFS v6 images are downloaded and then decompressed on demand as an uncompressed erofs image.

Quoted 2 lines

decompressed as a erofs image of uncompressed layout. Then the erofs image is mounted in fscache mode and serves as the container image. Thus

... in fscache mode for containers to use. IOWs

Quoted 2 lines

the current implementation won't break the container image distribution scenarios.

IOWs, currently compressed data is decompressed on the userspace side instead and uncompressed erofs images will be finally cached.

Quoted 3 lines

The fscache support for the compressed layout is still under development. Anyway, to avoid the potential crash, let's leave the

The fscache support for the compressed layout is still under development and it will be used for runtime decompression feature. Anyway..

Quoted 3 lines

compressed inodes unsupported in fscache mode until we support it later.

Fixes 1442b02b66ad ("erofs: implement fscache-based data read for non-inline layout")

Otherwise looks good to me,

Thanks,
Gao Xiang