aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Unterwurzacher2015-10-04 15:40:59 +0200
committerJakob Unterwurzacher2015-10-04 15:40:59 +0200
commitb27edba2bbf374b2e98d19d9fb3aa9f84721baf7 (patch)
tree7bc12390bc026a4a669b328d56405f79b2b0369b
parent089629442ddfcd8a0a7bde4b60746d20dd98da6f (diff)
Fix Trucate() bug causing files to be too small
Uncovered by running xfstests generic/014 several times
-rw-r--r--pathfs_frontend/file.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/pathfs_frontend/file.go b/pathfs_frontend/file.go
index 43114b2..47f935b 100644
--- a/pathfs_frontend/file.go
+++ b/pathfs_frontend/file.go
@@ -273,8 +273,8 @@ func (f *file) Truncate(newSize uint64) fuse.Status {
// File shrinks
} else {
blockNo := f.cfs.BlockNoPlainOff(newSize)
- lastBlockOff := blockNo * f.cfs.PlainBS()
- lastBlockLen := newSize - lastBlockOff
+ lastBlockOff := blockNo * f.cfs.CipherBS()
+ lastBlockLen := newSize - blockNo * f.cfs.PlainBS()
var data []byte
if lastBlockLen > 0 {
var status fuse.Status