diff mbox series

[ovs-dev,v2] reconnect.c: Don't transition back to ACTIVE when forced to RECONNECT.

Message ID 1553287265-36140-1-git-send-email-hzhou8@ebay.com
State Accepted
Headers show
Series [ovs-dev,v2] reconnect.c: Don't transition back to ACTIVE when forced to RECONNECT. | expand

Commit Message

Han Zhou March 22, 2019, 8:41 p.m. UTC
From: Han Zhou <hzhou8@ebay.com>

Currently, whenever there is activity on the session, the FSM is
transitioned to ACTIVE. However, this causes reconnect_force_reconnect()
failed to work once there are traffic received from remote after
transition to RECONNECT, it will skip the reconnection phase and directly
go back to ACTIVE for the old session. This patch fixes it so that
when FSM is in RECONNECT state, it doesn't transition back to ACTIVE
directly.

Signed-off-by: Han Zhou <hzhou8@ebay.com>
---

Notes:
    v1->v2: update according to Ben's suggestion: directly check S_IDLE

 lib/reconnect.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ben Pfaff March 22, 2019, 8:55 p.m. UTC | #1
On Fri, Mar 22, 2019 at 01:41:05PM -0700, Han Zhou wrote:
> From: Han Zhou <hzhou8@ebay.com>
> 
> Currently, whenever there is activity on the session, the FSM is
> transitioned to ACTIVE. However, this causes reconnect_force_reconnect()
> failed to work once there are traffic received from remote after
> transition to RECONNECT, it will skip the reconnection phase and directly
> go back to ACTIVE for the old session. This patch fixes it so that
> when FSM is in RECONNECT state, it doesn't transition back to ACTIVE
> directly.
> 
> Signed-off-by: Han Zhou <hzhou8@ebay.com>
> ---
> 
> Notes:
>     v1->v2: update according to Ben's suggestion: directly check S_IDLE

Thanks, applied to master.
Han Zhou March 28, 2019, 6:02 p.m. UTC | #2
On Fri, Mar 22, 2019 at 1:55 PM Ben Pfaff <blp@ovn.org> wrote:
>
> On Fri, Mar 22, 2019 at 01:41:05PM -0700, Han Zhou wrote:
> > From: Han Zhou <hzhou8@ebay.com>
> >
> > Currently, whenever there is activity on the session, the FSM is
> > transitioned to ACTIVE. However, this causes reconnect_force_reconnect()
> > failed to work once there are traffic received from remote after
> > transition to RECONNECT, it will skip the reconnection phase and directly
> > go back to ACTIVE for the old session. This patch fixes it so that
> > when FSM is in RECONNECT state, it doesn't transition back to ACTIVE
> > directly.
> >
> > Signed-off-by: Han Zhou <hzhou8@ebay.com>
> > ---
> >
> > Notes:
> >     v1->v2: update according to Ben's suggestion: directly check S_IDLE
>
> Thanks, applied to master.

Thanks Ben! It's better to be backported as far as Raft is released,
since it impacts Raft correctness during leader change.
Ben Pfaff March 28, 2019, 6:08 p.m. UTC | #3
On Thu, Mar 28, 2019 at 11:02:32AM -0700, Han Zhou wrote:
> On Fri, Mar 22, 2019 at 1:55 PM Ben Pfaff <blp@ovn.org> wrote:
> >
> > On Fri, Mar 22, 2019 at 01:41:05PM -0700, Han Zhou wrote:
> > > From: Han Zhou <hzhou8@ebay.com>
> > >
> > > Currently, whenever there is activity on the session, the FSM is
> > > transitioned to ACTIVE. However, this causes reconnect_force_reconnect()
> > > failed to work once there are traffic received from remote after
> > > transition to RECONNECT, it will skip the reconnection phase and directly
> > > go back to ACTIVE for the old session. This patch fixes it so that
> > > when FSM is in RECONNECT state, it doesn't transition back to ACTIVE
> > > directly.
> > >
> > > Signed-off-by: Han Zhou <hzhou8@ebay.com>
> > > ---
> > >
> > > Notes:
> > >     v1->v2: update according to Ben's suggestion: directly check S_IDLE
> >
> > Thanks, applied to master.
> 
> Thanks Ben! It's better to be backported as far as Raft is released,
> since it impacts Raft correctness during leader change.

OK, done.
diff mbox series

Patch

diff --git a/lib/reconnect.c b/lib/reconnect.c
index 0f21378..c89abab 100644
--- a/lib/reconnect.c
+++ b/lib/reconnect.c
@@ -495,7 +495,7 @@  reconnect_connect_failed(struct reconnect *fsm, long long int now, int error)
 void
 reconnect_activity(struct reconnect *fsm, long long int now)
 {
-    if (fsm->state != S_ACTIVE) {
+    if (fsm->state == S_IDLE) {
         reconnect_transition__(fsm, now, S_ACTIVE);
     }
     fsm->last_activity = now;