From e82d2ee8eea359a5489aa4c4c2ce57fc3aa8a479 Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Mon, 15 Jun 2020 20:19:42 +0200 Subject: [PATCH] Log and ignore if fallocate is not supported Signed-off-by: Jakub Sztandera --- ffiwrapper/partialfile.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ffiwrapper/partialfile.go b/ffiwrapper/partialfile.go index 094448e89..a2c1f1151 100644 --- a/ffiwrapper/partialfile.go +++ b/ffiwrapper/partialfile.go @@ -4,6 +4,7 @@ import ( "encoding/binary" "io" "os" + "syscall" "github.com/detailyang/go-fallocate" "golang.org/x/xerrors" @@ -63,6 +64,12 @@ func createPartialFile(maxPieceSize abi.PaddedPieceSize, path string) (*partialF err = func() error { err := fallocate.Fallocate(f, 0, int64(maxPieceSize)) + if errno, ok := err.(syscall.Errno); ok { + if errno == syscall.EOPNOTSUPP || errno == syscall.ENOSYS { + log.Warnf("could not allocated space, ignoring: %v", errno) + err = nil // log and ignore + } + } if err != nil { return xerrors.Errorf("fallocate '%s': %w", path, err) }