From 4f13ec5551076505395ad5b1c099f47eca06e63e Mon Sep 17 00:00:00 2001 From: Aaron Lehmann Date: Thu, 21 Jan 2016 10:01:51 -0800 Subject: [PATCH] Don't retry downloads when disk is full There was already a check that prevented protocol-level fallback in this situation, but retries within a specific protocol will still happen. This makes it take a long time for the pull to finally error out. This fixes slowness in TestDaemonNoSpaceleftOnDeviceError, which used to take a long time due to the backoff between retry attempts: PASS: docker_cli_daemon_test.go:1868: DockerDaemonSuite.TestDaemonNoSpaceleftOnDeviceError 5.882s Signed-off-by: Aaron Lehmann --- distribution/registry.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/distribution/registry.go b/distribution/registry.go index 1d4a2c4efe..0d77d3b230 100644 --- a/distribution/registry.go +++ b/distribution/registry.go @@ -6,6 +6,7 @@ import ( "net/http" "net/url" "strings" + "syscall" "time" "github.com/docker/distribution" @@ -147,6 +148,10 @@ func retryOnError(err error) error { } case *client.UnexpectedHTTPResponseError: return xfer.DoNotRetry{Err: err} + case error: + if strings.Contains(err.Error(), strings.ToLower(syscall.ENOSPC.Error())) { + return xfer.DoNotRetry{Err: err} + } } // let's be nice and fallback if the error is a completely // unexpected one.