diff options
author | Damjan Marion <damarion@cisco.com> | 2020-08-20 17:28:20 +0200 |
---|---|---|
committer | Andrew Yourtchenko <ayourtch@gmail.com> | 2020-09-16 10:15:52 +0000 |
commit | 2ee0098dee4e4130ae350ccfe526d88a826160c5 (patch) | |
tree | cd638ea93ec1ed2be8b69bdfc3a8240de6a39035 /src/plugins/avf/avf_api.c | |
parent | 95a77a2360c4315ab8a1178202d71d59e3b8c21f (diff) |
avf: fix race between avf process node and avf_delete_if(...)
It may happen that process node is suspended while it waits for response
from adminq and during that time CLI or API process can call
avf_delete_if. When avf process node resumes, it may happen that device
is not there anymeore.
This patch delegates interface deletion to process node, so CLI/API
process just sends signal instead of deleting device instance itself.
Type: fix
Change-Id: I7f12e12df3071650f6e60ad7eb5af23b7acfe335
Signed-off-by: Damjan Marion <damarion@cisco.com>
(cherry picked from commit 66bb7dd64ee2377103e18b96f1e6bf6405de44b5)
Diffstat (limited to 'src/plugins/avf/avf_api.c')
-rw-r--r-- | src/plugins/avf/avf_api.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/plugins/avf/avf_api.c b/src/plugins/avf/avf_api.c index 1ddc45f2348..504fa31eb3d 100644 --- a/src/plugins/avf/avf_api.c +++ b/src/plugins/avf/avf_api.c @@ -66,7 +66,6 @@ vl_api_avf_delete_t_handler (vl_api_avf_delete_t * mp) vnet_main_t *vnm = vnet_get_main (); avf_main_t *am = &avf_main; vl_api_avf_delete_reply_t *rmp; - avf_device_t *ad; vnet_hw_interface_t *hw; int rv = 0; @@ -79,9 +78,8 @@ vl_api_avf_delete_t_handler (vl_api_avf_delete_t * mp) goto reply; } - ad = pool_elt_at_index (am->devices, hw->dev_instance); - - avf_delete_if (vm, ad); + vlib_process_signal_event (vm, avf_process_node.index, + AVF_PROCESS_EVENT_DELETE_IF, hw->dev_instance); reply: REPLY_MACRO (VL_API_AVF_DELETE_REPLY + am->msg_id_base); @@ -93,6 +91,9 @@ static clib_error_t * avf_plugin_api_hookup (vlib_main_t * vm) { avf_main_t *avm = &avf_main; + api_main_t *am = vlibapi_get_main (); + + am->is_mp_safe[VL_API_AVF_DELETE] = 1; /* ask for a correctly-sized block of API message decode slots */ avm->msg_id_base = setup_message_id_table (); |