fusefrontend: truncateGrowFile: pass zeroPad error to caller

Errors from zeroPad were ignored until now, as discovered
using xfstests generic/083.
This commit is contained in:
Jakob Unterwurzacher 2018-08-15 17:14:24 +02:00
parent 0e1cbb75fe
commit dbd400d930
1 changed files with 5 additions and 2 deletions

View File

@ -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
}