From 6ebd9f1037f71702a841878ebae6142b3f902502 Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Sat, 21 Dec 2019 15:49:53 +0100 Subject: [PATCH] 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 --- zfs/zfs.go | 1 + 1 file changed, 1 insertion(+) diff --git a/zfs/zfs.go b/zfs/zfs.go index e518829..f77110d 100644 --- a/zfs/zfs.go +++ b/zfs/zfs.go @@ -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() {