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:
@@ -814,6 +814,7 @@ func ZFSRecv(ctx context.Context, fs string, streamCopier StreamCopier, opts Rec
|
|||||||
copierErrChan := make(chan StreamCopierError)
|
copierErrChan := make(chan StreamCopierError)
|
||||||
go func() {
|
go func() {
|
||||||
copierErrChan <- streamCopier.WriteStreamTo(stdinWriter)
|
copierErrChan <- streamCopier.WriteStreamTo(stdinWriter)
|
||||||
|
stdinWriter.Close()
|
||||||
}()
|
}()
|
||||||
waitErrChan := make(chan *ZFSError)
|
waitErrChan := make(chan *ZFSError)
|
||||||
go func() {
|
go func() {
|
||||||
|
|||||||
Reference in New Issue
Block a user