flow: cleanup locking debug leftovers

pull/7225/head
Victor Julien 3 years ago
parent 57533d3e47
commit 5deb479f4c

@ -1,4 +1,4 @@
/* Copyright (C) 2007-2020 Open Information Security Foundation
/* Copyright (C) 2007-2022 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
@ -717,19 +717,6 @@ static inline bool FlowIsTimedOut(const Flow *f, const uint32_t sec, const bool
return false;
}
static inline void FromHashLockBucket(FlowBucket *fb)
{
FBLOCK_LOCK(fb);
}
static inline void FromHashLockTO(Flow *f)
{
FLOWLOCK_WRLOCK(f);
}
static inline void FromHashLockCMP(Flow *f)
{
FLOWLOCK_WRLOCK(f);
}
/** \brief Get Flow for packet
*
* Hash retrieval function for flows. Looks up the hash bucket containing the
@ -755,7 +742,7 @@ Flow *FlowGetFlowFromHash(ThreadVars *tv, FlowLookupStruct *fls,
/* get our hash bucket and lock it */
const uint32_t hash = p->flow_hash;
FlowBucket *fb = &flow_hash[hash % flow_config.hash_size];
FromHashLockBucket(fb);
FBLOCK_LOCK(fb);
SCLogDebug("fb %p fb->head %p", fb, fb->head);
@ -792,7 +779,7 @@ Flow *FlowGetFlowFromHash(ThreadVars *tv, FlowLookupStruct *fls,
const bool timedout =
(fb_nextts < (uint32_t)p->ts.tv_sec && FlowIsTimedOut(f, (uint32_t)p->ts.tv_sec, emerg));
if (timedout) {
FromHashLockTO(f);//FLOWLOCK_WRLOCK(f);
FLOWLOCK_WRLOCK(f);
if (likely(f->use_cnt == 0)) {
next_f = f->next;
MoveToWorkQueue(tv, fls, fb, f, prev_f);
@ -801,7 +788,7 @@ Flow *FlowGetFlowFromHash(ThreadVars *tv, FlowLookupStruct *fls,
}
FLOWLOCK_UNLOCK(f);
} else if (FlowCompare(f, p) != 0) {
FromHashLockCMP(f);//FLOWLOCK_WRLOCK(f);
FLOWLOCK_WRLOCK(f);
/* found a matching flow that is not timed out */
if (unlikely(TcpSessionPacketSsnReuse(p, f, f->protoctx) == 1)) {
Flow *new_f = TcpReuseReplace(tv, fls, fb, f, hash, p);

@ -1,4 +1,4 @@
/* Copyright (C) 2007-2020 Open Information Security Foundation
/* Copyright (C) 2007-2022 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
@ -264,11 +264,6 @@ static inline int FlowBypassedTimeout(Flow *f, struct timeval *ts,
return 1;
}
static inline void FMFlowLock(Flow *f)
{
FLOWLOCK_WRLOCK(f);
}
typedef struct FlowManagerTimeoutThread {
/* used to temporarily store flows that have timed out and are
* removed from the hash */
@ -344,7 +339,7 @@ static void FlowManagerHashRowTimeout(FlowManagerTimeoutThread *td,
continue;
}
FMFlowLock(f); //FLOWLOCK_WRLOCK(f);
FLOWLOCK_WRLOCK(f);
Flow *next_flow = f->next;

Loading…
Cancel
Save