From af2d6579c510487c004820c13515b7b86fdb797f Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Sat, 29 Aug 2020 19:18:00 +0200 Subject: [PATCH] [#347] zfscmd: fix dangling trace Task on .Start() failure fixes #347 --- zfs/zfscmd/zfscmd.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/zfs/zfscmd/zfscmd.go b/zfs/zfscmd/zfscmd.go index d07c605..1cbc9ed 100644 --- a/zfs/zfscmd/zfscmd.go +++ b/zfs/zfscmd/zfscmd.go @@ -125,14 +125,16 @@ func (c *Cmd) startPre(newTask bool) { } func (c *Cmd) startPost(err error) { - now := time.Now() - c.mtx.Lock() + now := time.Now() c.startedAt = now - c.mtx.Unlock() startPostReport(c, err, now) startPostLogging(c, err, now) + + if err != nil { + c.waitReturnEndSpanCb() + } } func (c *Cmd) waitPre() {