diff options
author | Renato Westphal <renato@opensourcerouting.org> | 2019-09-17 02:51:11 +0200 |
---|---|---|
committer | Renato Westphal <renato@opensourcerouting.org> | 2019-09-18 19:35:10 +0200 |
commit | 8685be73e039dcb1b754e1fe21be96f60867219a (patch) | |
tree | 2f2bbd346162ed7672faefd0543211eec4c2ebd1 /lib/northbound_grpc.cpp | |
parent | lib: introduce new 'pre_validate' northbound callback (diff) | |
download | frr-8685be73e039dcb1b754e1fe21be96f60867219a.tar.xz frr-8685be73e039dcb1b754e1fe21be96f60867219a.zip |
Revert "lib: introduce a read-write lock for northbound configurations"
Adding a lock to protect the global running configuration doesn't
help much since the FRR daemons are not prepared to process
configuration changes in a pthread that is not the main one (a
whole lot of new protections would be necessary to prevent race
conditions).
This means the lock added by commit 83981138 only adds more
complexity for no benefit. Remove it now to simplify the code.
All northbound clients, including the gRPC one, should either run
in the main pthread or use synchronization primitives to process
configuration transactions in the main pthread.
This reverts commit 83981138fe8c1e0a40b8dede74eca65449dda5de.
Diffstat (limited to 'lib/northbound_grpc.cpp')
-rw-r--r-- | lib/northbound_grpc.cpp | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/lib/northbound_grpc.cpp b/lib/northbound_grpc.cpp index a55da23dd..1d6317b00 100644 --- a/lib/northbound_grpc.cpp +++ b/lib/northbound_grpc.cpp @@ -702,15 +702,10 @@ class NorthboundImpl final : public frr::Northbound::Service { struct lyd_node *dnode; - pthread_rwlock_rdlock(&running_config->lock); - { - dnode = yang_dnode_get(running_config->dnode, - path.empty() ? NULL - : path.c_str()); - if (dnode) - dnode = yang_dnode_dup(dnode); - } - pthread_rwlock_unlock(&running_config->lock); + dnode = yang_dnode_get(running_config->dnode, + path.empty() ? NULL : path.c_str()); + if (dnode) + dnode = yang_dnode_dup(dnode); return dnode; } @@ -817,11 +812,7 @@ class NorthboundImpl final : public frr::Northbound::Service struct candidate *candidate = &_candidates[candidate_id]; candidate->id = candidate_id; - pthread_rwlock_rdlock(&running_config->lock); - { - candidate->config = nb_config_dup(running_config); - } - pthread_rwlock_unlock(&running_config->lock); + candidate->config = nb_config_dup(running_config); candidate->transaction = NULL; return candidate; |