diff options
| author | Jakob Unterwurzacher | 2015-10-04 15:40:59 +0200 | 
|---|---|---|
| committer | Jakob Unterwurzacher | 2015-10-04 15:40:59 +0200 | 
| commit | b27edba2bbf374b2e98d19d9fb3aa9f84721baf7 (patch) | |
| tree | 7bc12390bc026a4a669b328d56405f79b2b0369b /pathfs_frontend | |
| parent | 089629442ddfcd8a0a7bde4b60746d20dd98da6f (diff) | |
Fix Trucate() bug causing files to be too small
Uncovered by running xfstests generic/014 several times
Diffstat (limited to 'pathfs_frontend')
| -rw-r--r-- | pathfs_frontend/file.go | 4 | 
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  | 
