简体   繁体   English

如何在FUSE / OSXFUSE低级API中使用entry_timeout和attr_timeout?

[英]How to use entry_timeout and attr_timeout in FUSE/OSXFUSE low-level API?

Is there any way to safely use non-zero timeouts in non-readonly filesystems? 有没有办法在非只读文件系统中安全地使用非零超时? I cannot seem to find one. 我好像找不到一个。 A couple of counter-examples: 一些反例:

Example One (non-zero negative entry timeout): 示例一(非零负输入超时):

  1. An application calls stat() and gets ENOENT; 应用程序调用stat()并获取ENOENT;
  2. calls create(); 调用create();
  3. calls stat(), expecting success, but gets ENOENT instead because of negative entry timeout, so it concludes the FS is broken/inconsistent/etc. 调用stat(),期望成功,但由于负输入超时而获得ENOENT,因此它断定FS已损坏/不一致/等。

Example Two (non-zero attr timeout): 示例二(非零attr超时):

  1. An application calls utimes(); 应用程序调用utimes();
  2. calls stat(), but gets stale values and concludes the FS is broken/inconsistent/etc. 调用stat(),但得到过时的值并得出结论FS已损坏/不一致/等。

I cannot come up with a counterexample for a positive entry timeout - it seems that even if lookup() returns some stale inode, the filesystem still can return ENOENT for the later getattr() call. 我无法想出一个正向输入超时的反例 - 似乎即使lookup()返回一些陈旧的inode,文件系统仍然可以返回ENOENT以用于稍后的getattr()调用。

But what about the above 2 examples? 但是上面两个例子呢?

Just for reference, the same question was posted on the FUSE mailing list . 仅供参考,同样的问题发布在FUSE邮件列表中

Here's the answer from Kyle Lippincott on why non-zero timeouts work: 以下是Kyle Lippincott关于为什么非零超时工作的答案

If the create() goes through the kernel, it invalidates the negative entry timeout. 如果create()通过内核,它会使负条目超时无效。 If the create happens externally, then the timeout still holds. 如果创建发生在外部,则超时仍然存在。

Quoting Goswin von Brederlow on when non-zero timeouts are a problem: 当非零超时成为问题时,请引用Goswin von Brederlow:

Caching only works correctly if you implement a disk based filesystem, one where only the fuse process can alter metadata and all access goes only through fuse. 如果您实现基于磁盘的文件系统,缓存只能正常工作,只有熔丝流程可以改变元数据,所有访问只能通过熔丝。 Any overlay filesystem where something can change the underlying filesystem without going through fuse can run into inconsistencies. 任何覆盖文件系统都可以在不经过保险丝的情况下改变底层文件系统,这可能会导致不一致。

So if you're eg building a network file system that allows multiple hosts to change the data you might get problems with non-zero timeouts. 因此,如果您正在构建允许多个主机更改数据的网络文件系统,则可能会出现非零超时问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM