diff --git a/backport-clean-up-inDelete-network-atomically.patch b/backport-clean-up-inDelete-network-atomically.patch new file mode 100644 index 0000000000000000000000000000000000000000..8db938c3ab95aa2d6c3b89beb9b83ee23d3f0d6d --- /dev/null +++ b/backport-clean-up-inDelete-network-atomically.patch @@ -0,0 +1,48 @@ +From dbbf124db33cbe4640da59fa03d91902162d7b8e Mon Sep 17 00:00:00 2001 +From: Cory Snider +Date: Tue, 25 Apr 2023 11:49:58 -0400 +Subject: [PATCH] Clean up inDelete network atomically + +The (*network).ipamRelease function nils out the network's IPAM info +fields, putting the network struct into an inconsistent state. The +network-restore startup code panics if it tries to restore a network +from a struct which has fewer IPAM config entries than IPAM info +entries. Therefore (*network).delete contains a critical section: by +persisting the network to the store after ipamRelease(), the datastore +will contain an inconsistent network until the deletion operation +completes and finishes deleting the network from the datastore. If for +any reason the deletion operation is interrupted between ipamRelease() +and deleteFromStore(), the daemon will crash on startup when it tries to +restore the network. + +Updating the datastore after releasing the network's IPAM pools may have +served a purpose in the past, when a global datastore was used for +intra-cluster communication and the IPAM allocator had persistent global +state, but nowadays there is no global datastore and the IPAM allocator +has no persistent state whatsoever. Remove the vestigial datastore +update as it is no longer necessary and only serves to cause problems. +If the network deletion is interrupted before the network is deleted +from the datastore, the deletion will resume during the next daemon +startup, including releasing the IPAM pools. + +Signed-off-by: Cory Snider +(cherry picked from commit moby/moby@c957ad006747df00730ce3aeaf4ac9df14baa998) +Signed-off-by: Cory Snider +--- + network.go | 3 --- + 1 file changed, 3 deletions(-) + +diff --git libnetwork-d00ceed44cc447c77f25cdf5d59e83163bdcb4c9/network.go libnetwork-d00ceed44cc447c77f25cdf5d59e83163bdcb4c9-b/network.go +index 734bb83cdd..7895ea53b1 100644 +--- libnetwork-d00ceed44cc447c77f25cdf5d59e83163bdcb4c9/network.go ++++ libnetwork-d00ceed44cc447c77f25cdf5d59e83163bdcb4c9-b/network.go +@@ -1064,9 +1064,6 @@ func (n *network) delete(force bool, rmLBEndpoint bool) error { + } + + n.ipamRelease() +- if err = c.updateToStore(n); err != nil { +- logrus.Warnf("Failed to update store after ipam release for network %s (%s): %v", n.Name(), n.ID(), err) +- } + + // We are about to delete the network. Leave the gossip + // cluster for the network to stop all incoming network diff --git a/libnetwork.spec b/libnetwork.spec index 8ab46f86b6a9c0abab686feae991e80c129c2a56..232525b596821fe564292712c69e1ed23b97ba23 100644 --- a/libnetwork.spec +++ b/libnetwork.spec @@ -1,13 +1,14 @@ %define debug_package %{nil} Name: libnetwork Version: 0.8.0.dev.2 -Release: 106 +Release: 107 Summary: Proxy used for docker port mapping License: CC-BY-SA-4.0 and MIT and Apache-2.0 and MPL-2.0 URL: https://github.com/docker/libnetwork Source: libnetwork-d00ceed.tar.gz Patch0001: backport-fix-deadlock-between-getSvcRecords-and-processEndpointDelete.patch +Patch0002: backport-clean-up-inDelete-network-atomically.patch BuildRequires: golang >= 1.8.3 BuildRequires: make @@ -20,6 +21,8 @@ Obsoletes: docker-proxy %prep %setup -c -n libnetwork %patch 0001 +%patch 0002 + %build cd libnetwork-d00ceed44cc447c77f25cdf5d59e83163bdcb4c9 @@ -51,6 +54,9 @@ install -p -m 755 libnetwork-d00ceed44cc447c77f25cdf5d59e83163bdcb4c9/docker-pro %{_bindir}/docker-proxy %changelog +* Thu Jul 18 2024 guojunding - 0.8.0.dev.2-107 +- Clean up inDelete network atomically + * Tue Jun 18 2024 guojunding - 0.8.0.dev.2-106 - Fix deadlock between getSvcRecords and processEndpointDelete