zfs: recv: fix deadlock if streamCopier returns io.EOF

Close the write end of the pipe
* before we start waiting on the error channels
* and after everything from streamCopier has been written to the pipe
This commit is contained in:
Christian Schwarz 2019-12-21 15:49:53 +01:00
parent 99ab16d7be
commit 6ebd9f1037

View File

@ -814,6 +814,7 @@ func ZFSRecv(ctx context.Context, fs string, streamCopier StreamCopier, opts Rec
copierErrChan := make(chan StreamCopierError)
go func() {
copierErrChan <- streamCopier.WriteStreamTo(stdinWriter)
stdinWriter.Close()
}()
waitErrChan := make(chan *ZFSError)
go func() {