restic/internal
Michael Eischer ce89018902 Fix data race in blob_saver
After the `BlobSaver` job is submitted, the buffer can be released and
reused by another `FileSaver` even before `BlobSaver.Save` returns. That
FileSaver will the change `buf.Data` leading to wrong backup statistics.

Found by `go test -race ./...`:

WARNING: DATA RACE
Write at 0x00c0000784a0 by goroutine 41:
  github.com/restic/restic/internal/archiver.(*FileSaver).saveFile()
      /home/michael/Projekte/restic/restic/internal/archiver/file_saver.go:176 +0x789
  github.com/restic/restic/internal/archiver.(*FileSaver).worker()
      /home/michael/Projekte/restic/restic/internal/archiver/file_saver.go:242 +0x2af
  github.com/restic/restic/internal/archiver.NewFileSaver.func2()
      /home/michael/Projekte/restic/restic/internal/archiver/file_saver.go:88 +0x5d
  golang.org/x/sync/errgroup.(*Group).Go.func1()
      /home/michael/go/pkg/mod/golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c/errgroup/errgroup.go:57 +0x91

Previous read at 0x00c0000784a0 by goroutine 29:
  github.com/restic/restic/internal/archiver.(*BlobSaver).Save()
      /home/michael/Projekte/restic/restic/internal/archiver/blob_saver.go:57 +0x1dd
  github.com/restic/restic/internal/archiver.(*BlobSaver).Save-fm()
      <autogenerated>:1 +0xac
  github.com/restic/restic/internal/archiver.(*FileSaver).saveFile()
      /home/michael/Projekte/restic/restic/internal/archiver/file_saver.go:191 +0x855
  github.com/restic/restic/internal/archiver.(*FileSaver).worker()
      /home/michael/Projekte/restic/restic/internal/archiver/file_saver.go:242 +0x2af
  github.com/restic/restic/internal/archiver.NewFileSaver.func2()
      /home/michael/Projekte/restic/restic/internal/archiver/file_saver.go:88 +0x5d
  golang.org/x/sync/errgroup.(*Group).Go.func1()
      /home/michael/go/pkg/mod/golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c/errgroup/errgroup.go:57 +0x91
2022-07-03 14:47:53 +02:00
..
archiver Fix data race in blob_saver 2022-07-03 14:47:53 +02:00
backend Merge pull request #3470 from MichaelEischer/sanitize-debug-log 2022-07-02 19:00:54 +02:00
bloblru
cache
checker adapt workers based on whether an operation is CPU or IO-bound 2022-07-03 12:19:26 +02:00
crypto
debug redact swift auth token in debug output 2022-07-02 18:47:35 +02:00
dump
errors all: Move away from pkg/errors, easy cases 2022-06-14 08:36:38 +02:00
filter
fs
fuse
hashing
limiter cmd/restic, limiter: Move config knowledge to internal packages 2022-06-22 18:29:58 +02:00
migrations
mock
options Don't crash if SecretString is uninitialized 2022-07-02 19:44:28 +02:00
pack repository: Rework blob saving to use an async pack uploader 2022-07-02 22:42:34 +02:00
repository adapt workers based on whether an operation is CPU or IO-bound 2022-07-03 12:19:26 +02:00
restic adapt workers based on whether an operation is CPU or IO-bound 2022-07-03 12:19:26 +02:00
restorer adapt workers based on whether an operation is CPU or IO-bound 2022-07-03 12:19:26 +02:00
selfupdate
test all: Move away from pkg/errors, easy cases 2022-06-14 08:36:38 +02:00
textfile
ui Print number of bytes added to the repo 2022-07-02 18:55:12 +02:00
walker adapt workers based on whether an operation is CPU or IO-bound 2022-07-03 12:19:26 +02:00