保险丝问题
我正在 python 上开发fuse fs(带有fuse-python 绑定)。我需要什么方法才能正确实现touch?目前我有下一个输出:
$ touch m/My\ files/d3elete1.me
touch: setting times of `m/My files/d3elete1.me': Invalid argument
文件存在“d3elete1.me”:
$ ls -l m/My\ files/d3elete1.me
-rw-rw-rw- 1 root root 0 Jul 28 15:28 m/My files/d3elete1.me
我还试图跟踪系统调用:
$ strace touch m/My\ files/d3elete1.me
...
open("m/My files/d3elete1.me", O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_LARGEFILE, 0666) = 3
dup2(3, 0) = 0
close(3) = 0
utimensat(0, NULL, NULL, 0) = -1 EINVAL (Invalid argument)
close(0) = 0
...
如您所见 utimensat 失败。我试图实现空的 utimens 和 utime 但它甚至没有被调用。
I am developing fuse fs at python (with fuse-python bindings). What method I need to implement that touch correctly work? At present I have next output:
$ touch m/My\ files/d3elete1.me
touch: setting times of `m/My files/d3elete1.me': Invalid argument
File exists "d3elete1.me":
$ ls -l m/My\ files/d3elete1.me
-rw-rw-rw- 1 root root 0 Jul 28 15:28 m/My files/d3elete1.me
Also I was trying to trace system calls:
$ strace touch m/My\ files/d3elete1.me
...
open("m/My files/d3elete1.me", O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_LARGEFILE, 0666) = 3
dup2(3, 0) = 0
close(3) = 0
utimensat(0, NULL, NULL, 0) = -1 EINVAL (Invalid argument)
close(0) = 0
...
As you see utimensat failed. I was trying to implement empty utimens and utime but its are not even called.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试使用 -f 选项启动熔断器。 Fuse 将停留在前台,您可以在控制台中看到错误。
Try launching fuse with the -f option. Fuse will stay in foreground and you can see errors in the console.
您必须实现
utimens
和getattr
。并非所有系统调用都必须直接映射到您可能期望的 C 调用。其中许多由 FUSE 在内部使用来检查和导航文件系统,具体取决于设置的 FUSE 选项。我相信在您的情况下,FUSE 会将
utimesat
解释为utimens
,并使用getattr
检查来验证请求的文件是否存在,并且具有预期的属性。Update0
这是一个很大的巧合。下面有一条评论建议该问题与 FUSE 不支持
utimensat
相关。事实并非如此。我在 Ubuntu 10.04 上使用 fusion-python 时得到了与您提供的完全相同的回溯。我查了一下,看起来fuse-python 0.2 绑定是针对FUSE 2.6 的,可能是一个细微的变化引入了这个错误(FUSE 现在是2.8 版)。我的解决方案是停止使用fuse-python(代码是一团丑陋的混乱),并且我找到了替代绑定 混乱。我没有回头,从此没有遇到任何麻烦。我强烈建议您看一下,您的初始化代码会更干净,并且只需要很少的更改即可适应新的绑定。最重要的是,它只有一个模块,并且易于阅读。
You must implement
utimens
andgetattr
. Not all the system calls necessarily map directly to the C calls you might be expecting. Many of them are used internally by FUSE to check and navigate your filesystem, depending on which FUSE options are set.I believe in your case FUSE is preceding it's interpretation of
utimesat
toutimens
, with agetattr
check to verify that the requested file is present, and has the expected attributes.Update0
This is a great coincidence. There is a comment below suggestion that the issue likes with the fact that FUSE does not support
utimensat
. This is not the case. I had the exact same traceback you've provided while using fuse-python on Ubuntu 10.04. I poked around a little, it would appear that the fuse-python 0.2 bindings are for FUSE 2.6, it may be that a slight change has introduced this error (FUSE is now at version 2.8). My solution was to stop using fuse-python (the code is an ugly mess), and I found an alternate binding fusepy. I've not looked back, and had no trouble since.I highly recommend you take a look, your initialization code will be cleaner, and minimal changes are required to adapt to to the new binding. Best of all, it's only one module, and an easy read.