| Age | Commit message (Collapse) | Author | 
 | 
When the old size is zero, there are no existing blocks to merge the
new data with. Directly use Ftruncate if the size is block-aligned.
Fixes https://github.com/rfjakob/gocryptfs/issues/305
 | 
 | 
Found with the 'codespell' utility.
 | 
 | 
When O_PATH is specified in flags, flag bits other than O_CLOEXEC, O_DIRECTORY,
and O_NOFOLLOW are ignored.
 | 
 | 
 | 
 | 
 | 
 | 
 | 
 | 
We already do 'defer fs.dirCache.Clear()', so this is no longer required.
 | 
 | 
This code was accidentially added in 4f66d66755da63c78b09201c6c72353009251cf2.
 | 
 | 
Bug looked like this:
  $ ls -l .
  total 0
  drwxrwxr-x. 2 jakob jakob 60 Jan  3 15:42 foo
  -rw-rw-r--. 1 jakob jakob  0 Jan  3 15:46 x
  $ ls -l .
  ls: cannot access '.': No such file or directory
(only happened when "" was in the dirCache)
 | 
 | 
 | 
 | 
Un-spaghettify the function and let the callers open
the directory.
 | 
 | 
Copy-paste error.
https://github.com/rfjakob/gocryptfs/issues/308
 | 
 | 
This function is in all fastpaths, will get a cache, and needs
its own file.
renamed:    internal/fusefrontend/names.go -> internal/fusefrontend/openbackingdir.go
renamed:    internal/fusefrontend/names_test.go -> internal/fusefrontend/openbackingdir_test.go
 | 
 | 
Finally allows us to delete EncryptPathDirIV.
 | 
 | 
* listxattr is fixed via the /proc/self/fd trick
* setxattr,removexattr are fixed by opening the file O_WRONLY
Fixes https://github.com/rfjakob/gocryptfs/issues/308
 | 
 | 
 | 
 | 
Darwin now also has these functions, use them. Simplifies
the code and makes it symlink-safe on Darwin as well.
 | 
 | 
Reported by @slackner at
https://github.com/rfjakob/gocryptfs/commit/932efbd4593fe6be6c86f0dafeaea32910b7c246#r31813373
thanks!
 | 
 | 
 | 
 | 
Thanks @slackner!
Fixes https://github.com/rfjakob/gocryptfs/issues/306
 | 
 | 
An Open() a fifo blocks until it is opened for writing.
This meant that xattr operations on FIFOs would block.
Pass O_NONBLOCK to fix that, and add a test.
 | 
 | 
This function is NOT symlink-safe. Darwin needs it because it lacks
fgetxattr(2) and friends.
 | 
 | 
Uses /proc/self/fd.
 | 
 | 
Uses /proc/self/fd on Linux.
 | 
 | 
Uses the /proc/self/fd trick.
 | 
 | 
Uses the /proc/self/fd trick, which does not work
on Darwin.
 | 
 | 
unix.UtimesNanoAt now also exists on Darwin, yay!
 | 
 | 
Failure was:
 + GOOS=darwin
 + GOARCH=amd64
 + go build -tags without_openssl
 # github.com/rfjakob/gocryptfs/internal/fusefrontend
 internal/fusefrontend/fs_dir.go:159:60: cannot use origMode | 448 (type uint16) as type uint32 in argument to syscallcompat.Fchmodat
 internal/fusefrontend/fs_dir.go:170:33: cannot use origMode (type uint16) as type uint32 in argument to syscallcompat.Fchmodat
 | 
 | 
No changes needed.
 | 
 | 
Now uses Unlinkat.
 | 
 | 
And also rename DeleteLongName() -> DeleteLongNameAt(). The
naming follow the names open the openat() etc syscalls.
 | 
 | 
Now symlink-safe through Readlinkat().
 | 
 | 
Interestingly, little or no performance impact:
$ ./benchmark.bash
Testing gocryptfs at /tmp/benchmark.bash.39W: gocryptfs v1.6-42-g30c2349-dirty; go-fuse v20170619-66-g6df8ddc; 2018-11-04 go1.11
Downloading linux-3.0.tar.gz
/tmp/linux-3.0.tar.gz                  100%[=========================================================================>]  92.20M  2.93MB/s    in 31s
2018-11-04 21:44:44 URL:https://cdn.kernel.org/pub/linux/kernel/v3.0/linux-3.0.tar.gz [96675825/96675825] -> "/tmp/linux-3.0.tar.gz" [1]
WRITE: 262144000 bytes (262 MB, 250 MiB) copied, 1.1808 s, 222 MB/s
READ:  262144000 bytes (262 MB, 250 MiB) copied, 0.866438 s, 303 MB/s
UNTAR: 24.745
MD5:   12.050
LS:    3.525
RM:    9.544
Note: kernel has been updated:
$ uname -a
Linux brikett 4.18.16-200.fc28.x86_64 #1 SMP Sat Oct 20 23:53:47 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
 | 
 | 
 | 
 | 
Instead of calling syscall.Open() ourselves, rely on
openBackingDir().
 | 
 | 
Use openBackingDir() and Fstatat().
High performance impact, though part of it should be
mitigated by adding DirIV caching to the new code paths.
$ ./benchmark.bash
Testing gocryptfs at /tmp/benchmark.bash.Eou: gocryptfs v1.6-37-ge3914b3-dirty; go-fuse v20170619-66-g6df8ddc; 2018-10-14 go1.11
WRITE: 262144000 bytes (262 MB, 250 MiB) copied, 1.2289 s, 213 MB/s
READ:  262144000 bytes (262 MB, 250 MiB) copied, 1.02616 s, 255 MB/s
UNTAR: 24.490
MD5:   13.120
LS:    3.368
RM:    9.232
 | 
 | 
openBackingDir() used encryptPath(), which is not symlink-safe
itself. Drop encryptPath() and implement our own directory walk.
Adds three seconds to untar and two seconds to rm:
$ ./benchmark.bash
Testing gocryptfs at /tmp/benchmark.bash.MzG: gocryptfs v1.6-36-g8fb3c2f-dirty; go-fuse v20170619-66-g6df8ddc; 2018-10-14 go1.11
WRITE: 262144000 bytes (262 MB, 250 MiB) copied, 1.25078 s, 210 MB/s
READ:  262144000 bytes (262 MB, 250 MiB) copied, 1.0318 s, 254 MB/s
UNTAR: 20.941
MD5:   11.568
LS:    1.638
RM:    5.337
 | 
 | 
Document which FUSE calls are already symlink-safe in
the function comment.
 | 
 | 
DecryptPath is now symlink-safe through the use of *at()
functions.
 | 
 | 
Make Access() symlink-safe through use of faccessat.
 | 
 | 
 | 
 | 
 | 
 | 
The same condition is already checked a few lines above, and 'err' is not
changed inbetween.
 | 
 | 
The directory was already created, so return success even if Fchownat fails.
The same error handling is already used if fs.args.PlaintextNames is false.
 | 
 | 
 | 
 | 
Also log inode number, fd number, offset and length.
Maybe help debugging https://github.com/rfjakob/gocryptfs/issues/269 .
 | 
 | 
Even though filesystem notifications aren't implemented for FUSE, I decided to
try my hand at implementing the autounmount feature (#128). I based it on the
EncFS autounmount code, which records filesystem accesses and checks every X
seconds whether it's idled long enough to unmount.
I've tested the feature locally, but I haven't added any tests for this flag.
I also haven't worked with Go before. So please let me know if there's
anything that should be done differently.
One particular concern: I worked from the assumption that the open files table
is unique per-filesystem. If that's not true, I'll need to add an open file
count and associated lock to the Filesystem type instead.
https://github.com/rfjakob/gocryptfs/pull/265
 | 
 | 
Error was:
  # github.com/rfjakob/gocryptfs/internal/fusefrontend
  internal/fusefrontend/fs.go:179: cannot use perms | 256 (type uint16) as type uint32 in argument to syscall.Fchmod
  internal/fusefrontend/fs.go:185: cannot use perms (type uint16) as type uint32 in argument to syscall.Fchmod
 | 
 | 
Use Openat() and the openBackingDir() helper so we
never follow symlinks.
 | 
 | 
Use Openat() and the openBackingDir() helper so we
never follow symlinks.
 |