Skip to content

Commit 6278e03

Browse files
committed
Merge branch 'tipc-small-fixes'
Jon Maloy says: ==================== tipc: two small fixes We fix a couple of rarely seen anomalies discovered during testing. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 8fa956e + 5ca509f commit 6278e03

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

net/tipc/link.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ struct tipc_stats {
8787
* @peer_bearer_id: bearer id used by link's peer endpoint
8888
* @bearer_id: local bearer id used by link
8989
* @tolerance: minimum link continuity loss needed to reset link [in ms]
90-
* @keepalive_intv: link keepalive timer interval
9190
* @abort_limit: # of unacknowledged continuity probes needed to reset link
9291
* @state: current state of link FSM
9392
* @peer_caps: bitmap describing capabilities of peer node
@@ -131,7 +130,6 @@ struct tipc_link {
131130
u32 peer_bearer_id;
132131
u32 bearer_id;
133132
u32 tolerance;
134-
unsigned long keepalive_intv;
135133
u32 abort_limit;
136134
u32 state;
137135
u16 peer_caps;

net/tipc/node.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -378,14 +378,13 @@ static void tipc_node_calculate_timer(struct tipc_node *n, struct tipc_link *l)
378378
{
379379
unsigned long tol = tipc_link_tolerance(l);
380380
unsigned long intv = ((tol / 4) > 500) ? 500 : tol / 4;
381-
unsigned long keepalive_intv = msecs_to_jiffies(intv);
382381

383382
/* Link with lowest tolerance determines timer interval */
384-
if (keepalive_intv < n->keepalive_intv)
385-
n->keepalive_intv = keepalive_intv;
383+
if (intv < n->keepalive_intv)
384+
n->keepalive_intv = intv;
386385

387-
/* Ensure link's abort limit corresponds to current interval */
388-
tipc_link_set_abort_limit(l, tol / jiffies_to_msecs(n->keepalive_intv));
386+
/* Ensure link's abort limit corresponds to current tolerance */
387+
tipc_link_set_abort_limit(l, tol / n->keepalive_intv);
389388
}
390389

391390
static void tipc_node_delete(struct tipc_node *node)
@@ -526,7 +525,7 @@ static void tipc_node_timeout(unsigned long data)
526525
if (rc & TIPC_LINK_DOWN_EVT)
527526
tipc_node_link_down(n, bearer_id, false);
528527
}
529-
mod_timer(&n->timer, jiffies + n->keepalive_intv);
528+
mod_timer(&n->timer, jiffies + msecs_to_jiffies(n->keepalive_intv));
530529
}
531530

532531
/**
@@ -735,6 +734,7 @@ void tipc_node_check_dest(struct net *net, u32 onode,
735734
bool accept_addr = false;
736735
bool reset = true;
737736
char *if_name;
737+
unsigned long intv;
738738

739739
*dupl_addr = false;
740740
*respond = false;
@@ -840,9 +840,11 @@ void tipc_node_check_dest(struct net *net, u32 onode,
840840
le->link = l;
841841
n->link_cnt++;
842842
tipc_node_calculate_timer(n, l);
843-
if (n->link_cnt == 1)
844-
if (!mod_timer(&n->timer, jiffies + n->keepalive_intv))
843+
if (n->link_cnt == 1) {
844+
intv = jiffies + msecs_to_jiffies(n->keepalive_intv);
845+
if (!mod_timer(&n->timer, intv))
845846
tipc_node_get(n);
847+
}
846848
}
847849
memcpy(&le->maddr, maddr, sizeof(*maddr));
848850
exit:
@@ -950,7 +952,7 @@ static void tipc_node_fsm_evt(struct tipc_node *n, int evt)
950952
state = SELF_UP_PEER_UP;
951953
break;
952954
case SELF_LOST_CONTACT_EVT:
953-
state = SELF_DOWN_PEER_LEAVING;
955+
state = SELF_DOWN_PEER_DOWN;
954956
break;
955957
case SELF_ESTABL_CONTACT_EVT:
956958
case PEER_LOST_CONTACT_EVT:
@@ -969,7 +971,7 @@ static void tipc_node_fsm_evt(struct tipc_node *n, int evt)
969971
state = SELF_UP_PEER_UP;
970972
break;
971973
case PEER_LOST_CONTACT_EVT:
972-
state = SELF_LEAVING_PEER_DOWN;
974+
state = SELF_DOWN_PEER_DOWN;
973975
break;
974976
case SELF_LOST_CONTACT_EVT:
975977
case PEER_ESTABL_CONTACT_EVT:

0 commit comments

Comments
 (0)