Skip to content

Commit c43c363

Browse files
biger410torvalds
authored andcommitted
ocfs2: o2net: don't shutdown connection when idle timeout
This patch series is to fix a possible message lost bug in ocfs2 when network go bad. This bug will cause ocfs2 hung forever even network become good again. The messages may lost in this case. After the tcp connection is established between two nodes, an idle timer will be set to check its state periodically, if no messages are received during this time, idle timer will timeout, it will shutdown the connection and try to reconnect, so pending messages in tcp queues will be lost. This messages may be from dlm. Dlm may get hung in this case. This may cause the whole ocfs2 cluster hung. This is very possible to happen when network state goes bad. Do the reconnect is useless, it will fail if network state is still bad. Just waiting there for network recovering may be a good idea, it will not lost messages and some node will be fenced until cluster goes into split-brain state, for this case, Tcp user timeout is used to override the tcp retransmit timeout. It will timeout after 25 days, user should have notice this through the provided log and fix the network, if they don't, ocfs2 will fall back to original reconnect way. This patch (of 3): Some messages in the tcp queue maybe lost if we shutdown the connection and reconnect when idle timeout. If packets lost and reconnect success, then the ocfs2 cluster maybe hung. To fix this, we can leave the connection there and do the fence decision when idle timeout, if network recover before fence dicision is made, the connection survive without lost any messages. This bug can be saw when network state go bad. It may cause ocfs2 hung forever if some packets lost. With this fix, ocfs2 will recover from hung if network becomes good again. Signed-off-by: Junxiao Bi <[email protected]> Reviewed-by: Srinivas Eeda <[email protected]> Reviewed-by: Mark Fasheh <[email protected]> Cc: Joel Becker <[email protected]> Cc: Joseph Qi <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 2b46263 commit c43c363

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

fs/ocfs2/cluster/tcp.c

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1536,16 +1536,20 @@ static void o2net_idle_timer(unsigned long data)
15361536
#endif
15371537

15381538
printk(KERN_NOTICE "o2net: Connection to " SC_NODEF_FMT " has been "
1539-
"idle for %lu.%lu secs, shutting it down.\n", SC_NODEF_ARGS(sc),
1540-
msecs / 1000, msecs % 1000);
1539+
"idle for %lu.%lu secs.\n",
1540+
SC_NODEF_ARGS(sc), msecs / 1000, msecs % 1000);
15411541

1542-
/*
1543-
* Initialize the nn_timeout so that the next connection attempt
1544-
* will continue in o2net_start_connect.
1542+
/* idle timerout happen, don't shutdown the connection, but
1543+
* make fence decision. Maybe the connection can recover before
1544+
* the decision is made.
15451545
*/
15461546
atomic_set(&nn->nn_timeout, 1);
1547+
o2quo_conn_err(o2net_num_from_nn(nn));
1548+
queue_delayed_work(o2net_wq, &nn->nn_still_up,
1549+
msecs_to_jiffies(O2NET_QUORUM_DELAY_MS));
1550+
1551+
o2net_sc_reset_idle_timer(sc);
15471552

1548-
o2net_sc_queue_work(sc, &sc->sc_shutdown_work);
15491553
}
15501554

15511555
static void o2net_sc_reset_idle_timer(struct o2net_sock_container *sc)
@@ -1560,6 +1564,15 @@ static void o2net_sc_reset_idle_timer(struct o2net_sock_container *sc)
15601564

15611565
static void o2net_sc_postpone_idle(struct o2net_sock_container *sc)
15621566
{
1567+
struct o2net_node *nn = o2net_nn_from_num(sc->sc_node->nd_num);
1568+
1569+
/* clear fence decision since the connection recover from timeout*/
1570+
if (atomic_read(&nn->nn_timeout)) {
1571+
o2quo_conn_up(o2net_num_from_nn(nn));
1572+
cancel_delayed_work(&nn->nn_still_up);
1573+
atomic_set(&nn->nn_timeout, 0);
1574+
}
1575+
15631576
/* Only push out an existing timer */
15641577
if (timer_pending(&sc->sc_idle_timeout))
15651578
o2net_sc_reset_idle_timer(sc);

0 commit comments

Comments
 (0)