Merge pull request #35388 from tonistiigi/rlock-fix

cluster: avoid recursive readlock on swarm info
diff --git a/Dockerfile b/Dockerfile
index bf86bdb..25da313 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -133,7 +133,7 @@
 	&& rm -rf "$GOPATH"
 
 # Get the "docker-py" source so we can run their integration tests
-ENV DOCKER_PY_COMMIT a962578e515185cf06506050b2200c0b81aa84ef
+ENV DOCKER_PY_COMMIT ca7a6132a418c32df6bb11ba9b2a8b9b2727227a
 # To run integration tests docker-pycreds is required.
 RUN git clone https://github.com/docker/docker-py.git /docker-py \
 	&& cd /docker-py \
diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64
index 4a4c635..97dff46 100644
--- a/Dockerfile.aarch64
+++ b/Dockerfile.aarch64
@@ -105,7 +105,7 @@
 	&& rm -rf "$GOPATH"
 
 # Get the "docker-py" source so we can run their integration tests
-ENV DOCKER_PY_COMMIT a962578e515185cf06506050b2200c0b81aa84ef
+ENV DOCKER_PY_COMMIT ca7a6132a418c32df6bb11ba9b2a8b9b2727227a
 # To run integration tests docker-pycreds is required.
 RUN git clone https://github.com/docker/docker-py.git /docker-py \
 	&& cd /docker-py \
diff --git a/Dockerfile.armhf b/Dockerfile.armhf
index e64bfd7..30ddf8c 100644
--- a/Dockerfile.armhf
+++ b/Dockerfile.armhf
@@ -103,7 +103,7 @@
 	&& rm -rf "$GOPATH"
 
 # Get the "docker-py" source so we can run their integration tests
-ENV DOCKER_PY_COMMIT a962578e515185cf06506050b2200c0b81aa84ef
+ENV DOCKER_PY_COMMIT ca7a6132a418c32df6bb11ba9b2a8b9b2727227a
 # To run integration tests docker-pycreds is required.
 RUN git clone https://github.com/docker/docker-py.git /docker-py \
 	&& cd /docker-py \
diff --git a/Dockerfile.ppc64le b/Dockerfile.ppc64le
index c95b68b..709a6e6 100644
--- a/Dockerfile.ppc64le
+++ b/Dockerfile.ppc64le
@@ -101,7 +101,7 @@
 	&& rm -rf "$GOPATH"
 
 # Get the "docker-py" source so we can run their integration tests
-ENV DOCKER_PY_COMMIT a962578e515185cf06506050b2200c0b81aa84ef
+ENV DOCKER_PY_COMMIT ca7a6132a418c32df6bb11ba9b2a8b9b2727227a
 # To run integration tests docker-pycreds is required.
 RUN git clone https://github.com/docker/docker-py.git /docker-py \
 	&& cd /docker-py \
diff --git a/Dockerfile.s390x b/Dockerfile.s390x
index b438a5d..752d052 100644
--- a/Dockerfile.s390x
+++ b/Dockerfile.s390x
@@ -95,7 +95,7 @@
 	&& rm -rf "$GOPATH"
 
 # Get the "docker-py" source so we can run their integration tests
-ENV DOCKER_PY_COMMIT a962578e515185cf06506050b2200c0b81aa84ef
+ENV DOCKER_PY_COMMIT ca7a6132a418c32df6bb11ba9b2a8b9b2727227a
 # To run integration tests docker-pycreds is required.
 RUN git clone https://github.com/docker/docker-py.git /docker-py \
 	&& cd /docker-py \
diff --git a/api/common.go b/api/common.go
index d0229e0..af34d0b 100644
--- a/api/common.go
+++ b/api/common.go
@@ -3,7 +3,7 @@
 // Common constants for daemon and client.
 const (
 	// DefaultVersion of Current REST API
-	DefaultVersion string = "1.34"
+	DefaultVersion string = "1.35"
 
 	// NoBaseImageSpecifier is the symbol used by the FROM
 	// command to specify that no base image is to be used.
diff --git a/daemon/info_unix.go b/daemon/info_unix.go
index fd2bbb4..9433434 100644
--- a/daemon/info_unix.go
+++ b/daemon/info_unix.go
@@ -3,6 +3,7 @@
 package daemon
 
 import (
+	"context"
 	"os/exec"
 	"strings"
 
@@ -48,20 +49,10 @@
 	}
 
 	v.ContainerdCommit.Expected = dockerversion.ContainerdCommitID
-	if rv, err := exec.Command("docker-containerd", "--version").Output(); err == nil {
-		parts := strings.Split(strings.TrimSpace(string(rv)), " ")
-		if len(parts) == 3 {
-			v.ContainerdCommit.ID = parts[2]
-		}
-		switch {
-		case v.ContainerdCommit.ID == "":
-			logrus.Warnf("failed to retrieve docker-containerd version: unknown format", string(rv))
-			v.ContainerdCommit.ID = "N/A"
-		case strings.HasSuffix(v.ContainerdCommit.ID, "-g"+v.ContainerdCommit.ID[len(v.ContainerdCommit.ID)-7:]):
-			v.ContainerdCommit.ID = v.ContainerdCommit.Expected
-		}
+	if rv, err := daemon.containerd.Version(context.Background()); err == nil {
+		v.ContainerdCommit.ID = rv.Revision
 	} else {
-		logrus.Warnf("failed to retrieve docker-containerd version: %v", err)
+		logrus.Warnf("failed to retrieve containerd version: %v", err)
 		v.ContainerdCommit.ID = "N/A"
 	}
 
diff --git a/hack/ci/janky b/hack/ci/janky
index fe04908..180f8c60 100755
--- a/hack/ci/janky
+++ b/hack/ci/janky
@@ -8,6 +8,6 @@
 hack/make.sh \
 	binary-daemon \
 	dynbinary \
-	test-integration \
 	test-docker-py \
+	test-integration \
 	cross
diff --git a/libcontainerd/client_daemon.go b/libcontainerd/client_daemon.go
index e651437..b0cdcfc 100644
--- a/libcontainerd/client_daemon.go
+++ b/libcontainerd/client_daemon.go
@@ -60,6 +60,10 @@
 	containers map[string]*container
 }
 
+func (c *client) Version(ctx context.Context) (containerd.Version, error) {
+	return c.remote.Version(ctx)
+}
+
 func (c *client) Restore(ctx context.Context, id string, attachStdio StdioCallback) (alive bool, pid int, err error) {
 	c.Lock()
 	defer c.Unlock()
diff --git a/libcontainerd/client_local_windows.go b/libcontainerd/client_local_windows.go
index c33e346..8ce9dfe 100644
--- a/libcontainerd/client_local_windows.go
+++ b/libcontainerd/client_local_windows.go
@@ -17,6 +17,7 @@
 
 	"github.com/Microsoft/hcsshim"
 	opengcs "github.com/Microsoft/opengcs/client"
+	"github.com/containerd/containerd"
 	"github.com/docker/docker/pkg/sysinfo"
 	"github.com/docker/docker/pkg/system"
 	specs "github.com/opencontainers/runtime-spec/specs-go"
@@ -70,6 +71,10 @@
 // of docker.
 const defaultOwner = "docker"
 
+func (c *client) Version(ctx context.Context) (containerd.Version, error) {
+	return containerd.Version{}, errors.New("not implemented on Windows")
+}
+
 // Create is the entrypoint to create a container from a spec.
 // Table below shows the fields required for HCS JSON calling parameters,
 // where if not populated, is omitted.
diff --git a/libcontainerd/types.go b/libcontainerd/types.go
index 9e05c16..9eede43 100644
--- a/libcontainerd/types.go
+++ b/libcontainerd/types.go
@@ -82,6 +82,8 @@
 
 // Client provides access to containerd features.
 type Client interface {
+	Version(ctx context.Context) (containerd.Version, error)
+
 	Restore(ctx context.Context, containerID string, attachStdio StdioCallback) (alive bool, pid int, err error)
 
 	Create(ctx context.Context, containerID string, spec *specs.Spec, runtimeOptions interface{}) error