Bug 4244 - [ANCK 4.19] erofs 使用fsid挂载时,读.c, .h文件乱码
Summary: [ANCK 4.19] erofs 使用fsid挂载时,读.c, .h文件乱码
Status: CLOSED INVALID
Alias: None
Product: ANCK 4.19 Dev
Classification: ANCK
Component: fs (show other bugs) fs
Version: 4.19-027.x
Hardware: All Linux
: P3-Medium S3-normal
Target Milestone: ---
Assignee: Jingbo Xu
QA Contact: shuming
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-28 10:53 UTC by 苟浩
Modified: 2023-03-05 19:53 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description 苟浩 uniontech_group 2023-02-28 10:53:16 UTC
Description of problem:
erofs 使用fsid挂载时,读读.c, .h文本文件乱码

Version-Release number of selected component (if applicable):

ck-release-4.19, tag: 4.19.91-27

How reproducible:


Steps to Reproduce:
1. 编译4.19.91-27的内核安装,打开CONFIG_EROFS_FS_ONDEMAND=y, CONFIG_CACHEFILES_ONDEMAND=y。
2. 下载测试代码:https://github.com/lostjeffle/demand-read-cachefilesd
3. cd demand-read-cachefilesd && mkdir mp cache
4. ./run.sh . mp cache

Actual results:
读文本文件:README.md可以正常显示:
$ vim README.md
[Quick Test]
============

1. Start cachefilesd2 daemon
----------------------------

You could run run.sh to start a quick test. This test will run mkfs.erofs
from @inputdir directory, start the cachefilesd2 daemon, and mount the built
erofs at @mntdir.
......


读hash.c等.c, .h文件显示乱码:
$ vim hash.c
^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@
.....


Expected results:

读文本文件显示正常结果

Additional info:

使用普通的erofs是可以正常显示的:
$ mkfs.erofs test.img demand-read-cachefilesd-main/
$ sudo mount -t erofs -o loop test.img mp
$ vim hash.c
#define _GNU_SOURCE
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdint.h>
...
Comment 1 苟浩 uniontech_group 2023-03-02 14:34:51 UTC
非bug,是我操作失误!