diff options
Diffstat (limited to 'fs/ocfs2/cluster/tcp.c')
-rw-r--r-- | fs/ocfs2/cluster/tcp.c | 47 |
1 files changed, 20 insertions, 27 deletions
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c index 4ea4b0a26975..1170918a9311 100644 --- a/fs/ocfs2/cluster/tcp.c +++ b/fs/ocfs2/cluster/tcp.c | |||
@@ -142,23 +142,17 @@ static void o2net_idle_timer(unsigned long data); | |||
142 | static void o2net_sc_postpone_idle(struct o2net_sock_container *sc); | 142 | static void o2net_sc_postpone_idle(struct o2net_sock_container *sc); |
143 | static void o2net_sc_reset_idle_timer(struct o2net_sock_container *sc); | 143 | static void o2net_sc_reset_idle_timer(struct o2net_sock_container *sc); |
144 | 144 | ||
145 | /* | 145 | static inline int o2net_reconnect_delay(void) |
146 | * FIXME: These should use to_o2nm_cluster_from_node(), but we end up | ||
147 | * losing our parent link to the cluster during shutdown. This can be | ||
148 | * solved by adding a pre-removal callback to configfs, or passing | ||
149 | * around the cluster with the node. -jeffm | ||
150 | */ | ||
151 | static inline int o2net_reconnect_delay(struct o2nm_node *node) | ||
152 | { | 146 | { |
153 | return o2nm_single_cluster->cl_reconnect_delay_ms; | 147 | return o2nm_single_cluster->cl_reconnect_delay_ms; |
154 | } | 148 | } |
155 | 149 | ||
156 | static inline int o2net_keepalive_delay(struct o2nm_node *node) | 150 | static inline int o2net_keepalive_delay(void) |
157 | { | 151 | { |
158 | return o2nm_single_cluster->cl_keepalive_delay_ms; | 152 | return o2nm_single_cluster->cl_keepalive_delay_ms; |
159 | } | 153 | } |
160 | 154 | ||
161 | static inline int o2net_idle_timeout(struct o2nm_node *node) | 155 | static inline int o2net_idle_timeout(void) |
162 | { | 156 | { |
163 | return o2nm_single_cluster->cl_idle_timeout_ms; | 157 | return o2nm_single_cluster->cl_idle_timeout_ms; |
164 | } | 158 | } |
@@ -444,9 +438,9 @@ static void o2net_set_nn_state(struct o2net_node *nn, | |||
444 | /* delay if we're withing a RECONNECT_DELAY of the | 438 | /* delay if we're withing a RECONNECT_DELAY of the |
445 | * last attempt */ | 439 | * last attempt */ |
446 | delay = (nn->nn_last_connect_attempt + | 440 | delay = (nn->nn_last_connect_attempt + |
447 | msecs_to_jiffies(o2net_reconnect_delay(NULL))) | 441 | msecs_to_jiffies(o2net_reconnect_delay())) |
448 | - jiffies; | 442 | - jiffies; |
449 | if (delay > msecs_to_jiffies(o2net_reconnect_delay(NULL))) | 443 | if (delay > msecs_to_jiffies(o2net_reconnect_delay())) |
450 | delay = 0; | 444 | delay = 0; |
451 | mlog(ML_CONN, "queueing conn attempt in %lu jiffies\n", delay); | 445 | mlog(ML_CONN, "queueing conn attempt in %lu jiffies\n", delay); |
452 | queue_delayed_work(o2net_wq, &nn->nn_connect_work, delay); | 446 | queue_delayed_work(o2net_wq, &nn->nn_connect_work, delay); |
@@ -460,7 +454,7 @@ static void o2net_set_nn_state(struct o2net_node *nn, | |||
460 | * the connect_expired work will do anything. The rest will see | 454 | * the connect_expired work will do anything. The rest will see |
461 | * that it's already queued and do nothing. | 455 | * that it's already queued and do nothing. |
462 | */ | 456 | */ |
463 | delay += msecs_to_jiffies(o2net_idle_timeout(NULL)); | 457 | delay += msecs_to_jiffies(o2net_idle_timeout()); |
464 | queue_delayed_work(o2net_wq, &nn->nn_connect_expired, delay); | 458 | queue_delayed_work(o2net_wq, &nn->nn_connect_expired, delay); |
465 | } | 459 | } |
466 | 460 | ||
@@ -1159,23 +1153,23 @@ static int o2net_check_handshake(struct o2net_sock_container *sc) | |||
1159 | * but isn't. This can ultimately cause corruption. | 1153 | * but isn't. This can ultimately cause corruption. |
1160 | */ | 1154 | */ |
1161 | if (be32_to_cpu(hand->o2net_idle_timeout_ms) != | 1155 | if (be32_to_cpu(hand->o2net_idle_timeout_ms) != |
1162 | o2net_idle_timeout(sc->sc_node)) { | 1156 | o2net_idle_timeout()) { |
1163 | mlog(ML_NOTICE, SC_NODEF_FMT " uses a network idle timeout of " | 1157 | mlog(ML_NOTICE, SC_NODEF_FMT " uses a network idle timeout of " |
1164 | "%u ms, but we use %u ms locally. disconnecting\n", | 1158 | "%u ms, but we use %u ms locally. disconnecting\n", |
1165 | SC_NODEF_ARGS(sc), | 1159 | SC_NODEF_ARGS(sc), |
1166 | be32_to_cpu(hand->o2net_idle_timeout_ms), | 1160 | be32_to_cpu(hand->o2net_idle_timeout_ms), |
1167 | o2net_idle_timeout(sc->sc_node)); | 1161 | o2net_idle_timeout()); |
1168 | o2net_ensure_shutdown(nn, sc, -ENOTCONN); | 1162 | o2net_ensure_shutdown(nn, sc, -ENOTCONN); |
1169 | return -1; | 1163 | return -1; |
1170 | } | 1164 | } |
1171 | 1165 | ||
1172 | if (be32_to_cpu(hand->o2net_keepalive_delay_ms) != | 1166 | if (be32_to_cpu(hand->o2net_keepalive_delay_ms) != |
1173 | o2net_keepalive_delay(sc->sc_node)) { | 1167 | o2net_keepalive_delay()) { |
1174 | mlog(ML_NOTICE, SC_NODEF_FMT " uses a keepalive delay of " | 1168 | mlog(ML_NOTICE, SC_NODEF_FMT " uses a keepalive delay of " |
1175 | "%u ms, but we use %u ms locally. disconnecting\n", | 1169 | "%u ms, but we use %u ms locally. disconnecting\n", |
1176 | SC_NODEF_ARGS(sc), | 1170 | SC_NODEF_ARGS(sc), |
1177 | be32_to_cpu(hand->o2net_keepalive_delay_ms), | 1171 | be32_to_cpu(hand->o2net_keepalive_delay_ms), |
1178 | o2net_keepalive_delay(sc->sc_node)); | 1172 | o2net_keepalive_delay()); |
1179 | o2net_ensure_shutdown(nn, sc, -ENOTCONN); | 1173 | o2net_ensure_shutdown(nn, sc, -ENOTCONN); |
1180 | return -1; | 1174 | return -1; |
1181 | } | 1175 | } |
@@ -1353,12 +1347,11 @@ static void o2net_initialize_handshake(void) | |||
1353 | { | 1347 | { |
1354 | o2net_hand->o2hb_heartbeat_timeout_ms = cpu_to_be32( | 1348 | o2net_hand->o2hb_heartbeat_timeout_ms = cpu_to_be32( |
1355 | O2HB_MAX_WRITE_TIMEOUT_MS); | 1349 | O2HB_MAX_WRITE_TIMEOUT_MS); |
1356 | o2net_hand->o2net_idle_timeout_ms = cpu_to_be32( | 1350 | o2net_hand->o2net_idle_timeout_ms = cpu_to_be32(o2net_idle_timeout()); |
1357 | o2net_idle_timeout(NULL)); | ||
1358 | o2net_hand->o2net_keepalive_delay_ms = cpu_to_be32( | 1351 | o2net_hand->o2net_keepalive_delay_ms = cpu_to_be32( |
1359 | o2net_keepalive_delay(NULL)); | 1352 | o2net_keepalive_delay()); |
1360 | o2net_hand->o2net_reconnect_delay_ms = cpu_to_be32( | 1353 | o2net_hand->o2net_reconnect_delay_ms = cpu_to_be32( |
1361 | o2net_reconnect_delay(NULL)); | 1354 | o2net_reconnect_delay()); |
1362 | } | 1355 | } |
1363 | 1356 | ||
1364 | /* ------------------------------------------------------------ */ | 1357 | /* ------------------------------------------------------------ */ |
@@ -1404,8 +1397,8 @@ static void o2net_idle_timer(unsigned long data) | |||
1404 | 1397 | ||
1405 | printk(KERN_INFO "o2net: connection to " SC_NODEF_FMT " has been idle for %u.%u " | 1398 | printk(KERN_INFO "o2net: connection to " SC_NODEF_FMT " has been idle for %u.%u " |
1406 | "seconds, shutting it down.\n", SC_NODEF_ARGS(sc), | 1399 | "seconds, shutting it down.\n", SC_NODEF_ARGS(sc), |
1407 | o2net_idle_timeout(sc->sc_node) / 1000, | 1400 | o2net_idle_timeout() / 1000, |
1408 | o2net_idle_timeout(sc->sc_node) % 1000); | 1401 | o2net_idle_timeout() % 1000); |
1409 | mlog(ML_NOTICE, "here are some times that might help debug the " | 1402 | mlog(ML_NOTICE, "here are some times that might help debug the " |
1410 | "situation: (tmr %ld.%ld now %ld.%ld dr %ld.%ld adv " | 1403 | "situation: (tmr %ld.%ld now %ld.%ld dr %ld.%ld adv " |
1411 | "%ld.%ld:%ld.%ld func (%08x:%u) %ld.%ld:%ld.%ld)\n", | 1404 | "%ld.%ld:%ld.%ld func (%08x:%u) %ld.%ld:%ld.%ld)\n", |
@@ -1433,10 +1426,10 @@ static void o2net_sc_reset_idle_timer(struct o2net_sock_container *sc) | |||
1433 | { | 1426 | { |
1434 | o2net_sc_cancel_delayed_work(sc, &sc->sc_keepalive_work); | 1427 | o2net_sc_cancel_delayed_work(sc, &sc->sc_keepalive_work); |
1435 | o2net_sc_queue_delayed_work(sc, &sc->sc_keepalive_work, | 1428 | o2net_sc_queue_delayed_work(sc, &sc->sc_keepalive_work, |
1436 | msecs_to_jiffies(o2net_keepalive_delay(sc->sc_node))); | 1429 | msecs_to_jiffies(o2net_keepalive_delay())); |
1437 | do_gettimeofday(&sc->sc_tv_timer); | 1430 | do_gettimeofday(&sc->sc_tv_timer); |
1438 | mod_timer(&sc->sc_idle_timeout, | 1431 | mod_timer(&sc->sc_idle_timeout, |
1439 | jiffies + msecs_to_jiffies(o2net_idle_timeout(sc->sc_node))); | 1432 | jiffies + msecs_to_jiffies(o2net_idle_timeout())); |
1440 | } | 1433 | } |
1441 | 1434 | ||
1442 | static void o2net_sc_postpone_idle(struct o2net_sock_container *sc) | 1435 | static void o2net_sc_postpone_idle(struct o2net_sock_container *sc) |
@@ -1578,8 +1571,8 @@ static void o2net_connect_expired(struct work_struct *work) | |||
1578 | mlog(ML_ERROR, "no connection established with node %u after " | 1571 | mlog(ML_ERROR, "no connection established with node %u after " |
1579 | "%u.%u seconds, giving up and returning errors.\n", | 1572 | "%u.%u seconds, giving up and returning errors.\n", |
1580 | o2net_num_from_nn(nn), | 1573 | o2net_num_from_nn(nn), |
1581 | o2net_idle_timeout(NULL) / 1000, | 1574 | o2net_idle_timeout() / 1000, |
1582 | o2net_idle_timeout(NULL) % 1000); | 1575 | o2net_idle_timeout() % 1000); |
1583 | 1576 | ||
1584 | o2net_set_nn_state(nn, NULL, 0, -ENOTCONN); | 1577 | o2net_set_nn_state(nn, NULL, 0, -ENOTCONN); |
1585 | } | 1578 | } |
@@ -1634,7 +1627,7 @@ static void o2net_hb_node_up_cb(struct o2nm_node *node, int node_num, | |||
1634 | 1627 | ||
1635 | /* ensure an immediate connect attempt */ | 1628 | /* ensure an immediate connect attempt */ |
1636 | nn->nn_last_connect_attempt = jiffies - | 1629 | nn->nn_last_connect_attempt = jiffies - |
1637 | (msecs_to_jiffies(o2net_reconnect_delay(node)) + 1); | 1630 | (msecs_to_jiffies(o2net_reconnect_delay()) + 1); |
1638 | 1631 | ||
1639 | if (node_num != o2nm_this_node()) { | 1632 | if (node_num != o2nm_this_node()) { |
1640 | /* believe it or not, accept and node hearbeating testing | 1633 | /* believe it or not, accept and node hearbeating testing |