aboutsummaryrefslogtreecommitdiff
path: root/pathfs_frontend/file.go
AgeCommit message (Collapse)Author
2016-01-25Convert fdLock to an RWMutex and protect the whole transactionJakob Unterwurzacher
...against concurrent closes. The testcase (set -e; while true; do truncate -s $RANDOM b; done) & (set -e; while true; do truncate -s $RANDOM b; done) & uncovered lots of unnecessary RMW failures that were the result of concurrent closes. With this patch, the only remaining error is "Truncate on forgotten file" that is probably caused by a problem in the go-fuse lib ( https://github.com/hanwen/go-fuse/issues/95 )
2016-01-24Only warn once for unsupported fallocate(2) and truncate(2)Jakob Unterwurzacher
Also, print the inode number in Ftruncate warnings.
2016-01-24Add per-inode write mutexJakob Unterwurzacher
At the moment, FUSE writes to a single file are serialized by the kernel. However, it is unclear if this is guaranteed behaviour or may change in the future. This patch adds our own per-inode write lock to rule out races regardless of kernel behavoir.
2016-01-20Convert logging to standard Go log.LoggerJakob Unterwurzacher
This is in preparation of logging to syslog.
2016-01-07Disable fallocate on OSX (not available and causes a build failure)Jakob Unterwurzacher
2015-12-19Increase GCM IV size from 96 to 128 bitsJakob Unterwurzacher
This pushes back the birthday bound for collisions to make it virtually irrelevant.
2015-12-19diriv: handle directory rename over directoryJakob Unterwurzacher
If an empty directory is overwritten we will always get ENOTEMPTY as the "empty" directory will still contain gocryptfs.diriv. Handle that case by removing the target directory and trying again. Fixes issue #10
2015-12-13go fmtJakob Unterwurzacher
...and minimal comment changes.
2015-12-13Handle EINTR returned by FallocateJakob Unterwurzacher
Fallocate can return EINTR (interrupted system call) and does so quite often when cpu profiling is enabled.
2015-12-08go fmtJakob Unterwurzacher
2015-12-06fallocate the space needed for the file header beforehandJakob Unterwurzacher
This makes sure writing to a file fails early if the underlying filesystem does not support fallocate. It also prevents partial header write due to ENOSPC.
2015-11-08Handle ENOSPC errors better by preallocating the space before writingJakob Unterwurzacher
Prevent the case that we run out of space in the middle of writing a block - that would leave a corrupt block behind.
2015-11-01Remove code detected by "deadcode"Jakob Unterwurzacher
go get github.com/remyoudompheng/go-misc/deadcode
2015-11-01Refactor ciphertext <-> plaintext offset translation functionsJakob Unterwurzacher
Move all the intelligence into the new file address_translation.go. That the calculations were spread out too much became apparent when adding the file header. This should make the code much easier to modify in the future.
2015-11-01Add file header (on-disk-format change)Jakob Unterwurzacher
Format: [ "Version" uint16 big endian ] [ "Id" 16 random bytes ] Quoting SECURITY.md: * Every file has a header that contains a 16-byte random *file id* * Each block uses the file id and its block number as GCM *authentication data* * This means the position of the blocks is protected as well. The blocks can not be reordered or copied between different files without causing an decryption error.
2015-10-06Use block number as authentication dataJakob Unterwurzacher
2015-10-04Utimens: Use UtimesNano instead of FutimesJakob Unterwurzacher
Futimes() only takes microsecond resolution while the FUSE call Utimens() wants nanosecond precision. This is why UTIME_OMIT did not work - this change fixes the xfstests generic/258 test failure. The go library does not provide a FutimesNano() function which is why I use UtimesNano() on /proc/self/fd/n. This is what the Go library does in Futimes().
2015-10-04fallocate: return ENOSYSJakob Unterwurzacher
The implementation was incomplete, disable fallocate completely for now. See https://github.com/rfjakob/gocryptfs/issues/1 Fixes xfstests generic/075
2015-10-04truncate: Fix bug that caused xfstests generic/030 to failJakob Unterwurzacher
The bug was caused by using cipherOff where plainOff should have been used. Renamed the symbols for less confusion.
2015-10-04Truncate: Logging improvements, show number of blocks as floatJakob Unterwurzacher
2015-10-04Fix Trucate() bug causing files to be too smallJakob Unterwurzacher
Uncovered by running xfstests generic/014 several times
2015-10-04Run go fmtJakob Unterwurzacher
2015-10-04intraBlock: Rename Offset to SkipJakob Unterwurzacher
"Offset" is unclear whether it is an offset from the start of file or start of block. "Skip" seems much better.
2015-10-04Utilize file hole passtrough capability in Truncate()Jakob Unterwurzacher
Cuts down the runtime of xfstests generic/014 from 1822 seconds to 36 seconds
2015-10-04Zero-pad last block if a file hole is created on Write()Jakob Unterwurzacher
Fixes TestFileHoles test
2015-10-04Fix xfstests generic/030 failureJakob Unterwurzacher
The actual fix is oldSize := f.cfs.PlainSize(uint64(fi.Size())) the rest is logging improvements
2015-10-03debug: log inode number instead of encrypted filenameJakob Unterwurzacher
Makes the log output smaller and more readable.
2015-09-30tests: Add append testJakob Unterwurzacher
2015-09-30Implement Truncate() + TestJakob Unterwurzacher
2015-09-30debug: Log encrypted filenameJakob Unterwurzacher
2015-09-16Fix symlink size reportingJakob Unterwurzacher
2015-09-09Fix File.GettAttr() size reportingJakob Unterwurzacher
The too-large reported value broke mmap (applications saw appended zero bytes) Also * Add locking for all fd operations * Add "--debug" command line switch
2015-09-08Explain both frontends in readmeJakob Unterwurzacher
Also, re-enable openssl and disable debug messages so testing gocryptfs is less painful
2015-09-08tests: add TestCiphertextRangeJakob Unterwurzacher
2015-09-08Fix append issueJakob Unterwurzacher
2015-09-08More debug logging, improve main_test.go (do not use all-zero content)Jakob Unterwurzacher
2015-09-08Add pathfs frontend, part IIJakob Unterwurzacher
Fix issues in read and write paths. Now passes selftest.
2015-09-08Add pathfs frontend (uses go-fuse instead of bazil-fuse), part IJakob Unterwurzacher
Currently fails main_test.go, will be fixed in part II