Bug 218101

Summary: [fuse] [request] support entry_timeout / attr_timeout
Product: Base System Reporter: Ben RUBSON <ben.rubson>
Component: kernAssignee: freebsd-fs mailing list <fs>
Status: Closed DUPLICATE    
Severity: Affects Some People CC: cem
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   

Description Ben RUBSON 2017-03-24 21:20:37 UTC
Hello,

Would be nice if fuse could support following options :
- entry_timeout (entry_valid fuse field)
- attr_timeout  (attr_valid  fuse field)

From Linux mount.fuse man :
entry_timeout=T
The timeout in seconds for which name lookups will be cached.
attr_timeout=T
The timeout in seconds for which file/directory attributes are cached.

This would help some fuse FS to work correctly, for example the encfs reverse mode, which relies on both of them set to 0.
Related bug : https://github.com/vgough/encfs/issues/315

Many thanks !

Ben
Comment 1 Ben RUBSON 2017-08-11 21:26:22 UTC
Here is a test case for this request report :

# Create a Fuse EncFS in reverse mode (will give an encrypted view of the plain folder) :
plain=/tmp/encfs_test/plain
ciphr=/tmp/encfs_test/ciphr
mkdir -p $plain $ciphr
encfs --extpass="echo test" --standard $plain $ciphr --reverse

# Update a file in the plain folder
while [ 1 ]; do echo >>$plain/file ; sleep 0.5; done

# Monitor the files in the encrypted view :
while [ 1 ]; do clear; stat $ciphr/*; sleep 0.5; done

As you can see, the timestamps correctly get updated, but not the sizes.

It's then dangerous because if you open the encrypted file
(using dd for example, dd if=$ciphr/... of=/dev/null),
it will then be truncated (!) to the size being displayed by stat,
whereas it was in reality much bigger, as its plain version was growing.

I found fuse sysctls, some are cache related, but no benefit.

Adding "-o attr_timeout=0 -o entry_timeout=0" to the encfs command
in Linux makes this to work.

Thank you !

Ben
Comment 2 Conrad Meyer freebsd_committer 2018-08-10 08:31:13 UTC

*** This bug has been marked as a duplicate of bug 230258 ***