【发布时间】:2016-12-09 18:16:10
【问题描述】:
我在使用 python-fuse 时遇到问题。这是该问题的一个独立示例:https://gist.github.com/ensonic/87e4108a7be64412d1c5a553b7e01f88
挂载fake-in-memory文件系统时,可以列出内容,但可以读取文件:
> ls -al ~/temp/mount/
total 1
-r--r--r-- 1 user group 34 Aug 3 22:44 test.txt
> cat ~/temp/mount/test.txt
cat: /home/user/temp/mount/test.txt: Invalid argument
当我在前台 (-d) 运行 fuse fs 时,我得到以下调试信息:
LOOKUP /test.txt
getattr /test.txt
NODEID: 2
unique: 120, success, outsize: 144
unique: 121, opcode: OPEN (14), nodeid: 2, insize: 48, pid: 10342
open flags: 0x8000 /test.txt
open[0] flags: 0x8000 /test.txt
unique: 121, success, outsize: 32
unique: 122, opcode: READ (15), nodeid: 2, insize: 80, pid: 10342
read[0] 4096 bytes from 0 flags: 0x8000
unique: 122, error: -22 (Invalid argument), outsize: 16
unique: 123, opcode: READ (15), nodeid: 2, insize: 80, pid: 10342
read[0] 4096 bytes from 0 flags: 0x8000
unique: 123, error: -22 (Invalid argument), outsize: 16
unique: 124, opcode: FLUSH (25), nodeid: 2, insize: 64, pid: 10342
unique: 124, error: -38 (Function not implemented), outsize: 16
unique: 125, opcode: RELEASE (18), nodeid: 2, insize: 64, pid: 0
release[0] flags: 0x8000
unique: 125, success, outsize: 16
我的日志文件有:
INFO:fakefs:open fake file /test.txt
INFO:fakefs:read from /test.txt, offs 0, size 4096, len 34
INFO:fakefs:read remainder
INFO:fakefs:read() = 34 bytes
INFO:fakefs:read from /test.txt, offs 0, size 4096, len 34
INFO:fakefs:read remainder
INFO:fakefs:read() = 34 bytes
INFO:fakefs:released(/test.txt) = 0
我想知道的是: 1)为什么读取完成两次(从0个标志读取[0] 4096字节:0x8000) 2) 为什么它返回 EINVAL?我返回数据 - 我的代码中没有单个 EINVAL。
在实际示例中,我也实现了 fs 的其余功能,这不是问题。
【问题讨论】: