diff options
author | Jakob Unterwurzacher | 2018-08-15 17:14:24 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2018-08-15 17:25:22 +0200 |
commit | dbd400d930ccd790c2918f6382c0efaeb353c282 (patch) | |
tree | c7bbd0033f014da3efa35928b59f1ed7fdece89f | |
parent | 0e1cbb75fed40d658c72d7fb65c7b012b1b4d31d (diff) |
fusefrontend: truncateGrowFile: pass zeroPad error to caller
Errors from zeroPad were ignored until now, as discovered
using xfstests generic/083.
-rw-r--r-- | internal/fusefrontend/file_allocate_truncate.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/internal/fusefrontend/file_allocate_truncate.go b/internal/fusefrontend/file_allocate_truncate.go index 34fe2c0..e735d79 100644 --- a/internal/fusefrontend/file_allocate_truncate.go +++ b/internal/fusefrontend/file_allocate_truncate.go @@ -198,7 +198,10 @@ func (f *File) truncateGrowFile(oldPlainSz uint64, newPlainSz uint64) fuse.Statu // // Make sure the old last block is padded to the block boundary. This call // is a no-op if it is already block-aligned. - f.zeroPad(oldPlainSz) + status := f.zeroPad(oldPlainSz) + if !status.Ok() { + return status + } // The new size is block-aligned. In this case we can do everything ourselves // and avoid the call to doWrite. if newPlainSz%f.contentEnc.PlainBS() == 0 { @@ -220,6 +223,6 @@ func (f *File) truncateGrowFile(oldPlainSz uint64, newPlainSz uint64) fuse.Statu // The new size is NOT aligned, so we need to write a partial block. // Write a single zero to the last byte and let doWrite figure it out. buf := make([]byte, 1) - _, status := f.doWrite(buf, int64(newEOFOffset)) + _, status = f.doWrite(buf, int64(newEOFOffset)) return status } |