aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSunil Mushran <sunil.mushran@oracle.com>2011-07-24 13:22:54 -0400
committerSunil Mushran <sunil.mushran@oracle.com>2011-07-24 13:22:54 -0400
commit1dfecf810e0eacb35987905082f23e5c2cd26e91 (patch)
tree106f0d7f7f9a0bd28fadf9f29e592d7745f44219
parentd2eece376648d2f7ba0a7d78f3c4d0421e608ac2 (diff)
ocfs2/cluster: Clean up messages in o2net
o2net messages needed a facelift. Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
-rw-r--r--fs/ocfs2/cluster/tcp.c119
1 files changed, 53 insertions, 66 deletions
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
index db5ee4b4f47a..6e97895ecf24 100644
--- a/fs/ocfs2/cluster/tcp.c
+++ b/fs/ocfs2/cluster/tcp.c
@@ -545,7 +545,7 @@ static void o2net_set_nn_state(struct o2net_node *nn,
545 } 545 }
546 546
547 if (was_valid && !valid) { 547 if (was_valid && !valid) {
548 printk(KERN_NOTICE "o2net: no longer connected to " 548 printk(KERN_NOTICE "o2net: No longer connected to "
549 SC_NODEF_FMT "\n", SC_NODEF_ARGS(old_sc)); 549 SC_NODEF_FMT "\n", SC_NODEF_ARGS(old_sc));
550 o2net_complete_nodes_nsw(nn); 550 o2net_complete_nodes_nsw(nn);
551 } 551 }
@@ -555,7 +555,7 @@ static void o2net_set_nn_state(struct o2net_node *nn,
555 cancel_delayed_work(&nn->nn_connect_expired); 555 cancel_delayed_work(&nn->nn_connect_expired);
556 printk(KERN_NOTICE "o2net: %s " SC_NODEF_FMT "\n", 556 printk(KERN_NOTICE "o2net: %s " SC_NODEF_FMT "\n",
557 o2nm_this_node() > sc->sc_node->nd_num ? 557 o2nm_this_node() > sc->sc_node->nd_num ?
558 "connected to" : "accepted connection from", 558 "Connected to" : "Accepted connection from",
559 SC_NODEF_ARGS(sc)); 559 SC_NODEF_ARGS(sc));
560 } 560 }
561 561
@@ -643,7 +643,7 @@ static void o2net_state_change(struct sock *sk)
643 o2net_sc_queue_work(sc, &sc->sc_connect_work); 643 o2net_sc_queue_work(sc, &sc->sc_connect_work);
644 break; 644 break;
645 default: 645 default:
646 printk(KERN_INFO "o2net: connection to " SC_NODEF_FMT 646 printk(KERN_INFO "o2net: Connection to " SC_NODEF_FMT
647 " shutdown, state %d\n", 647 " shutdown, state %d\n",
648 SC_NODEF_ARGS(sc), sk->sk_state); 648 SC_NODEF_ARGS(sc), sk->sk_state);
649 o2net_sc_queue_work(sc, &sc->sc_shutdown_work); 649 o2net_sc_queue_work(sc, &sc->sc_shutdown_work);
@@ -1284,11 +1284,11 @@ static int o2net_check_handshake(struct o2net_sock_container *sc)
1284 struct o2net_node *nn = o2net_nn_from_num(sc->sc_node->nd_num); 1284 struct o2net_node *nn = o2net_nn_from_num(sc->sc_node->nd_num);
1285 1285
1286 if (hand->protocol_version != cpu_to_be64(O2NET_PROTOCOL_VERSION)) { 1286 if (hand->protocol_version != cpu_to_be64(O2NET_PROTOCOL_VERSION)) {
1287 mlog(ML_NOTICE, SC_NODEF_FMT " advertised net protocol " 1287 printk(KERN_NOTICE "o2net: " SC_NODEF_FMT " Advertised net "
1288 "version %llu but %llu is required, disconnecting\n", 1288 "protocol version %llu but %llu is required. "
1289 SC_NODEF_ARGS(sc), 1289 "Disconnecting.\n", SC_NODEF_ARGS(sc),
1290 (unsigned long long)be64_to_cpu(hand->protocol_version), 1290 (unsigned long long)be64_to_cpu(hand->protocol_version),
1291 O2NET_PROTOCOL_VERSION); 1291 O2NET_PROTOCOL_VERSION);
1292 1292
1293 /* don't bother reconnecting if its the wrong version. */ 1293 /* don't bother reconnecting if its the wrong version. */
1294 o2net_ensure_shutdown(nn, sc, -ENOTCONN); 1294 o2net_ensure_shutdown(nn, sc, -ENOTCONN);
@@ -1302,33 +1302,33 @@ static int o2net_check_handshake(struct o2net_sock_container *sc)
1302 */ 1302 */
1303 if (be32_to_cpu(hand->o2net_idle_timeout_ms) != 1303 if (be32_to_cpu(hand->o2net_idle_timeout_ms) !=
1304 o2net_idle_timeout()) { 1304 o2net_idle_timeout()) {
1305 mlog(ML_NOTICE, SC_NODEF_FMT " uses a network idle timeout of " 1305 printk(KERN_NOTICE "o2net: " SC_NODEF_FMT " uses a network "
1306 "%u ms, but we use %u ms locally. disconnecting\n", 1306 "idle timeout of %u ms, but we use %u ms locally. "
1307 SC_NODEF_ARGS(sc), 1307 "Disconnecting.\n", SC_NODEF_ARGS(sc),
1308 be32_to_cpu(hand->o2net_idle_timeout_ms), 1308 be32_to_cpu(hand->o2net_idle_timeout_ms),
1309 o2net_idle_timeout()); 1309 o2net_idle_timeout());
1310 o2net_ensure_shutdown(nn, sc, -ENOTCONN); 1310 o2net_ensure_shutdown(nn, sc, -ENOTCONN);
1311 return -1; 1311 return -1;
1312 } 1312 }
1313 1313
1314 if (be32_to_cpu(hand->o2net_keepalive_delay_ms) != 1314 if (be32_to_cpu(hand->o2net_keepalive_delay_ms) !=
1315 o2net_keepalive_delay()) { 1315 o2net_keepalive_delay()) {
1316 mlog(ML_NOTICE, SC_NODEF_FMT " uses a keepalive delay of " 1316 printk(KERN_NOTICE "o2net: " SC_NODEF_FMT " uses a keepalive "
1317 "%u ms, but we use %u ms locally. disconnecting\n", 1317 "delay of %u ms, but we use %u ms locally. "
1318 SC_NODEF_ARGS(sc), 1318 "Disconnecting.\n", SC_NODEF_ARGS(sc),
1319 be32_to_cpu(hand->o2net_keepalive_delay_ms), 1319 be32_to_cpu(hand->o2net_keepalive_delay_ms),
1320 o2net_keepalive_delay()); 1320 o2net_keepalive_delay());
1321 o2net_ensure_shutdown(nn, sc, -ENOTCONN); 1321 o2net_ensure_shutdown(nn, sc, -ENOTCONN);
1322 return -1; 1322 return -1;
1323 } 1323 }
1324 1324
1325 if (be32_to_cpu(hand->o2hb_heartbeat_timeout_ms) != 1325 if (be32_to_cpu(hand->o2hb_heartbeat_timeout_ms) !=
1326 O2HB_MAX_WRITE_TIMEOUT_MS) { 1326 O2HB_MAX_WRITE_TIMEOUT_MS) {
1327 mlog(ML_NOTICE, SC_NODEF_FMT " uses a heartbeat timeout of " 1327 printk(KERN_NOTICE "o2net: " SC_NODEF_FMT " uses a heartbeat "
1328 "%u ms, but we use %u ms locally. disconnecting\n", 1328 "timeout of %u ms, but we use %u ms locally. "
1329 SC_NODEF_ARGS(sc), 1329 "Disconnecting.\n", SC_NODEF_ARGS(sc),
1330 be32_to_cpu(hand->o2hb_heartbeat_timeout_ms), 1330 be32_to_cpu(hand->o2hb_heartbeat_timeout_ms),
1331 O2HB_MAX_WRITE_TIMEOUT_MS); 1331 O2HB_MAX_WRITE_TIMEOUT_MS);
1332 o2net_ensure_shutdown(nn, sc, -ENOTCONN); 1332 o2net_ensure_shutdown(nn, sc, -ENOTCONN);
1333 return -1; 1333 return -1;
1334 } 1334 }
@@ -1539,28 +1539,16 @@ static void o2net_idle_timer(unsigned long data)
1539{ 1539{
1540 struct o2net_sock_container *sc = (struct o2net_sock_container *)data; 1540 struct o2net_sock_container *sc = (struct o2net_sock_container *)data;
1541 struct o2net_node *nn = o2net_nn_from_num(sc->sc_node->nd_num); 1541 struct o2net_node *nn = o2net_nn_from_num(sc->sc_node->nd_num);
1542
1543#ifdef CONFIG_DEBUG_FS 1542#ifdef CONFIG_DEBUG_FS
1544 ktime_t now = ktime_get(); 1543 unsigned long msecs = ktime_to_ms(ktime_get()) -
1544 ktime_to_ms(sc->sc_tv_timer);
1545#else
1546 unsigned long msecs = o2net_idle_timeout();
1545#endif 1547#endif
1546 1548
1547 printk(KERN_NOTICE "o2net: connection to " SC_NODEF_FMT " has been idle for %u.%u " 1549 printk(KERN_NOTICE "o2net: Connection to " SC_NODEF_FMT " has been "
1548 "seconds, shutting it down.\n", SC_NODEF_ARGS(sc), 1550 "idle for %lu.%lu secs, shutting it down.\n", SC_NODEF_ARGS(sc),
1549 o2net_idle_timeout() / 1000, 1551 msecs / 1000, msecs % 1000);
1550 o2net_idle_timeout() % 1000);
1551
1552#ifdef CONFIG_DEBUG_FS
1553 mlog(ML_NOTICE, "Here are some times that might help debug the "
1554 "situation: (Timer: %lld, Now %lld, DataReady %lld, Advance %lld-%lld, "
1555 "Key 0x%08x, Func %u, FuncTime %lld-%lld)\n",
1556 (long long)ktime_to_us(sc->sc_tv_timer), (long long)ktime_to_us(now),
1557 (long long)ktime_to_us(sc->sc_tv_data_ready),
1558 (long long)ktime_to_us(sc->sc_tv_advance_start),
1559 (long long)ktime_to_us(sc->sc_tv_advance_stop),
1560 sc->sc_msg_key, sc->sc_msg_type,
1561 (long long)ktime_to_us(sc->sc_tv_func_start),
1562 (long long)ktime_to_us(sc->sc_tv_func_stop));
1563#endif
1564 1552
1565 /* 1553 /*
1566 * Initialize the nn_timeout so that the next connection attempt 1554 * Initialize the nn_timeout so that the next connection attempt
@@ -1693,8 +1681,8 @@ static void o2net_start_connect(struct work_struct *work)
1693 1681
1694out: 1682out:
1695 if (ret) { 1683 if (ret) {
1696 mlog(ML_NOTICE, "connect attempt to " SC_NODEF_FMT " failed " 1684 printk(KERN_NOTICE "o2net: Connect attempt to " SC_NODEF_FMT
1697 "with errno %d\n", SC_NODEF_ARGS(sc), ret); 1685 " failed with errno %d\n", SC_NODEF_ARGS(sc), ret);
1698 /* 0 err so that another will be queued and attempted 1686 /* 0 err so that another will be queued and attempted
1699 * from set_nn_state */ 1687 * from set_nn_state */
1700 if (sc) 1688 if (sc)
@@ -1717,8 +1705,8 @@ static void o2net_connect_expired(struct work_struct *work)
1717 1705
1718 spin_lock(&nn->nn_lock); 1706 spin_lock(&nn->nn_lock);
1719 if (!nn->nn_sc_valid) { 1707 if (!nn->nn_sc_valid) {
1720 mlog(ML_ERROR, "no connection established with node %u after " 1708 printk(KERN_NOTICE "o2net: No connection established with "
1721 "%u.%u seconds, giving up and returning errors.\n", 1709 "node %u after %u.%u seconds, giving up.\n",
1722 o2net_num_from_nn(nn), 1710 o2net_num_from_nn(nn),
1723 o2net_idle_timeout() / 1000, 1711 o2net_idle_timeout() / 1000,
1724 o2net_idle_timeout() % 1000); 1712 o2net_idle_timeout() % 1000);
@@ -1861,21 +1849,21 @@ static int o2net_accept_one(struct socket *sock)
1861 1849
1862 node = o2nm_get_node_by_ip(sin.sin_addr.s_addr); 1850 node = o2nm_get_node_by_ip(sin.sin_addr.s_addr);
1863 if (node == NULL) { 1851 if (node == NULL) {
1864 mlog(ML_NOTICE, "attempt to connect from unknown node at %pI4:%d\n", 1852 printk(KERN_NOTICE "o2net: Attempt to connect from unknown "
1865 &sin.sin_addr.s_addr, ntohs(sin.sin_port)); 1853 "node at %pI4:%d\n", &sin.sin_addr.s_addr,
1854 ntohs(sin.sin_port));
1866 ret = -EINVAL; 1855 ret = -EINVAL;
1867 goto out; 1856 goto out;
1868 } 1857 }
1869 1858
1870 if (o2nm_this_node() >= node->nd_num) { 1859 if (o2nm_this_node() >= node->nd_num) {
1871 local_node = o2nm_get_node_by_num(o2nm_this_node()); 1860 local_node = o2nm_get_node_by_num(o2nm_this_node());
1872 mlog(ML_NOTICE, "unexpected connect attempt seen at node '%s' (" 1861 printk(KERN_NOTICE "o2net: Unexpected connect attempt seen "
1873 "%u, %pI4:%d) from node '%s' (%u, %pI4:%d)\n", 1862 "at node '%s' (%u, %pI4:%d) from node '%s' (%u, "
1874 local_node->nd_name, local_node->nd_num, 1863 "%pI4:%d)\n", local_node->nd_name, local_node->nd_num,
1875 &(local_node->nd_ipv4_address), 1864 &(local_node->nd_ipv4_address),
1876 ntohs(local_node->nd_ipv4_port), 1865 ntohs(local_node->nd_ipv4_port), node->nd_name,
1877 node->nd_name, node->nd_num, &sin.sin_addr.s_addr, 1866 node->nd_num, &sin.sin_addr.s_addr, ntohs(sin.sin_port));
1878 ntohs(sin.sin_port));
1879 ret = -EINVAL; 1867 ret = -EINVAL;
1880 goto out; 1868 goto out;
1881 } 1869 }
@@ -1900,10 +1888,10 @@ static int o2net_accept_one(struct socket *sock)
1900 ret = 0; 1888 ret = 0;
1901 spin_unlock(&nn->nn_lock); 1889 spin_unlock(&nn->nn_lock);
1902 if (ret) { 1890 if (ret) {
1903 mlog(ML_NOTICE, "attempt to connect from node '%s' at " 1891 printk(KERN_NOTICE "o2net: Attempt to connect from node '%s' "
1904 "%pI4:%d but it already has an open connection\n", 1892 "at %pI4:%d but it already has an open connection\n",
1905 node->nd_name, &sin.sin_addr.s_addr, 1893 node->nd_name, &sin.sin_addr.s_addr,
1906 ntohs(sin.sin_port)); 1894 ntohs(sin.sin_port));
1907 goto out; 1895 goto out;
1908 } 1896 }
1909 1897
@@ -1983,7 +1971,7 @@ static int o2net_open_listening_sock(__be32 addr, __be16 port)
1983 1971
1984 ret = sock_create(PF_INET, SOCK_STREAM, IPPROTO_TCP, &sock); 1972 ret = sock_create(PF_INET, SOCK_STREAM, IPPROTO_TCP, &sock);
1985 if (ret < 0) { 1973 if (ret < 0) {
1986 mlog(ML_ERROR, "unable to create socket, ret=%d\n", ret); 1974 printk(KERN_ERR "o2net: Error %d while creating socket\n", ret);
1987 goto out; 1975 goto out;
1988 } 1976 }
1989 1977
@@ -2000,16 +1988,15 @@ static int o2net_open_listening_sock(__be32 addr, __be16 port)
2000 sock->sk->sk_reuse = 1; 1988 sock->sk->sk_reuse = 1;
2001 ret = sock->ops->bind(sock, (struct sockaddr *)&sin, sizeof(sin)); 1989 ret = sock->ops->bind(sock, (struct sockaddr *)&sin, sizeof(sin));
2002 if (ret < 0) { 1990 if (ret < 0) {
2003 mlog(ML_ERROR, "unable to bind socket at %pI4:%u, " 1991 printk(KERN_ERR "o2net: Error %d while binding socket at "
2004 "ret=%d\n", &addr, ntohs(port), ret); 1992 "%pI4:%u\n", ret, &addr, ntohs(port));
2005 goto out; 1993 goto out;
2006 } 1994 }
2007 1995
2008 ret = sock->ops->listen(sock, 64); 1996 ret = sock->ops->listen(sock, 64);
2009 if (ret < 0) { 1997 if (ret < 0)
2010 mlog(ML_ERROR, "unable to listen on %pI4:%u, ret=%d\n", 1998 printk(KERN_ERR "o2net: Error %d while listening on %pI4:%u\n",
2011 &addr, ntohs(port), ret); 1999 ret, &addr, ntohs(port));
2012 }
2013 2000
2014out: 2001out:
2015 if (ret) { 2002 if (ret) {