From 3e96712c47dd490a43216069033927ff1c73feb5 Mon Sep 17 00:00:00 2001 From: Rodrigo Barbieri Date: Fri, 26 Aug 2016 18:13:00 -0300 Subject: [PATCH] Fix race condition updating routes Generic driver updates routes on host according to the tap interfaces created for use by share servers. That code should be within a lock to prevent a thread failing to delete a route previously listed and already deleted by another thread. This change moves an existing lock to the function that performs route changes while also covering the function that had the lock before. Closes-bug: #1617461 Change-Id: I798e5d9b0bc9ebefc8661d0ade720c60303cf484 --- manila/share/drivers/service_instance.py | 4 ++-- releasenotes/notes/generic-route-racing-adf92d212f1ab4de.yaml | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/generic-route-racing-adf92d212f1ab4de.yaml diff --git a/manila/share/drivers/service_instance.py b/manila/share/drivers/service_instance.py index f17ad6e2c5..a845d1ab35 100644 --- a/manila/share/drivers/service_instance.py +++ b/manila/share/drivers/service_instance.py @@ -948,6 +948,8 @@ class NeutronNetworkHelper(BaseNetworkhelper): device.route.clear_outdated_routes(subnet['cidr']) self._plug_interface_in_host(interface_name, device, port) + @utils.synchronized("service_instance_plug_interface_in_host", + external=True) def _plug_interface_in_host(self, interface_name, device, port): self.vif_driver.plug(interface_name, port['id'], port['mac_address']) @@ -966,8 +968,6 @@ class NeutronNetworkHelper(BaseNetworkhelper): # here we are checking for garbage devices from removed service port self._remove_outdated_interfaces(device) - @utils.synchronized( - "service_instance_remove_outdated_interfaces", external=True) def _remove_outdated_interfaces(self, device): """Finds and removes unused network device.""" device_cidr_set = self._get_set_of_device_cidrs(device) diff --git a/releasenotes/notes/generic-route-racing-adf92d212f1ab4de.yaml b/releasenotes/notes/generic-route-racing-adf92d212f1ab4de.yaml new file mode 100644 index 0000000000..688e1cfb62 --- /dev/null +++ b/releasenotes/notes/generic-route-racing-adf92d212f1ab4de.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - Fixed race-condition in generic driver while updating + network routes in host.