daemon: read-copy-update the daemon config
**- What I did**
Made daemon config reloading transactional and almost entirely atomic. Config reloading will either succeed or leave the daemon state untouched. Reloading no longer pauses the world. Daemon operations see a consistent and immutable view of the daemon config, even when racing a reload.

**- How I did it**
- Made the `config.Config` struct copyable by removing the embedded mutexes
- Implemented read-copy-update of the daemon config to replace the embedded mutex for synchronization
  - Reading from daemon config is request-scoped, like contexts: any operations which need to access the daemon config capture a reference to an immutable snapshot and pass it into any callees
- Implemented two-phase commit to manage the side effects of config reloading
  - Side effects such as `registryService.ReplaceConfig()` are not necessarily atomic w.r.t. the reload transaction as they can take effect before the updated config is applied to `configStore`
- Modified how runtimes wrapper scripts are written so that existing wrapper scripts are no longer deleted on reload
  - reloads do not invalidate old versions of the config that concurrent daemon operations might be holding references to, which might reference old wrapper scripts
  - FS errors while updating the wrapper scripts can no longer leave containers or the daemon in a bad state

**- How to verify it**
CI

**- Description for the changelog**
<!--
Write a short (one line) summary that describes the changes in this
pull request for inclusion in the changelog:
-->
- Configuration reloading has been made more robust: in the event that an error is encountered during the reload process, there is no longer a chance for some of the options to be applied anyway.

**- A picture of a cute animal (not mandatory but encouraged)**


api/server/router/build/build.go
package build // import "github.com/docker/docker/api/server/router/build"

import (
	"runtime"

	"github.com/docker/docker/api/server/router"
	"github.com/docker/docker/api/types"
)

// buildRouter is a router to talk with the build controller
type buildRouter struct {
	backend  Backend
	daemon   experimentalProvider
	routes   []router.Route
	features *map[string]bool
}

// NewRouter initializes a new build router
func NewRouter(b Backend, d experimentalProvider, features *map[string]bool) router.Router {
	r := &buildRouter{
		backend:  b,
		daemon:   d,
		features: features,
	}
	r.initRoutes()
	return r
}

// Routes returns the available routers to the build controller
func (r *buildRouter) Routes() []router.Route {
	return r.routes
}

func (r *buildRouter) initRoutes() {
	r.routes = []router.Route{
		router.NewPostRoute("/build", r.postBuild),
		router.NewPostRoute("/build/prune", r.postPrune),
		router.NewPostRoute("/build/cancel", r.postCancel),
	}
}

// BuilderVersion derives the default docker builder version from the config.
//
// The default on Linux is version "2" (BuildKit), but the daemon can be
// configured to recommend version "1" (classic Builder). Windows does not
// yet support BuildKit for native Windows images, and uses "1" (classic builder)
// as a default.
//
// This value is only a recommendation as advertised by the daemon, and it is
// up to the client to choose which builder to use.
func BuilderVersion(features map[string]bool) types.BuilderVersion {
	// TODO(thaJeztah) move the default to daemon/config
	if runtime.GOOS == "windows" {
		return types.BuilderV1
	}

	bv := types.BuilderBuildKit
	if v, ok := features["buildkit"]; ok && !v {
		bv = types.BuilderV1
	}
	return bv
}

package build // import "github.com/docker/docker/api/server/router/build"

import (
	"runtime"

	"github.com/docker/docker/api/server/router"
	"github.com/docker/docker/api/types"
)

// buildRouter is a router to talk with the build controller
type buildRouter struct {
	backend Backend
	daemon  experimentalProvider
	routes  []router.Route
}

// NewRouter initializes a new build router
func NewRouter(b Backend, d experimentalProvider) router.Router {
	r := &buildRouter{
		backend: b,
		daemon:  d,
	}
	r.initRoutes()
	return r
}

// Routes returns the available routers to the build controller
func (r *buildRouter) Routes() []router.Route {
	return r.routes
}

func (r *buildRouter) initRoutes() {
	r.routes = []router.Route{
		router.NewPostRoute("/build", r.postBuild),
		router.NewPostRoute("/build/prune", r.postPrune),
		router.NewPostRoute("/build/cancel", r.postCancel),
	}
}

// BuilderVersion derives the default docker builder version from the config.
//
// The default on Linux is version "2" (BuildKit), but the daemon can be
// configured to recommend version "1" (classic Builder). Windows does not
// yet support BuildKit for native Windows images, and uses "1" (classic builder)
// as a default.
//
// This value is only a recommendation as advertised by the daemon, and it is
// up to the client to choose which builder to use.
func BuilderVersion(features map[string]bool) types.BuilderVersion {
	// TODO(thaJeztah) move the default to daemon/config
	if runtime.GOOS == "windows" {
		return types.BuilderV1
	}

	bv := types.BuilderBuildKit
	if v, ok := features["buildkit"]; ok && !v {
		bv = types.BuilderV1
	}
	return bv
}

👀 🤦 
I totally missed that this was happening.