[PATCH v2] lib: Fix lock reversal in timerwheel

  • From: Dimitri Staessens <dimitri@ouroboros.rocks>
  • To: ouroboros@xxxxxxxxxxxxx
  • Date: Sat, 26 Feb 2022 17:44:06 +0100

There was a lock reversal in the timerwheel. There still is a thorough
revision needed of the locking in dev.c after the FRCP logic is
completed and tuned.

Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
---
 src/lib/frct.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/src/lib/frct.c b/src/lib/frct.c
index 2793f3c4..42ce2152 100644
--- a/src/lib/frct.c
+++ b/src/lib/frct.c
@@ -233,8 +233,6 @@ static void __send_frct_pkt(int      fd,
 
         f = &ai.flows[fd];
 
-        pthread_rwlock_rdlock(&ai.lock);
-
         if (f->qs.cypher_s > 0 && crypt_encrypt(f, sdb) < 0)
                 goto fail;
 
@@ -247,12 +245,9 @@ static void __send_frct_pkt(int      fd,
 
         shm_flow_set_notify(f->set, f->flow_id, FLOW_PKT);
 
-        pthread_rwlock_unlock(&ai.lock);
-
         return;
 
  fail:
-        pthread_rwlock_unlock(&ai.lock);
         ipcp_sdb_release(sdb);
         return;
 }
-- 
2.35.1


Other related posts: