From patchwork Thu Oct 25 10:36:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: piaojun X-Patchwork-Id: 10655703 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A284714BB for ; Thu, 25 Oct 2018 10:36:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8BB3E27968 for ; Thu, 25 Oct 2018 10:36:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7F36D283C5; Thu, 25 Oct 2018 10:36:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C69EC27968 for ; Thu, 25 Oct 2018 10:36:56 +0000 (UTC) Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w9PAYOaK178953; Thu, 25 Oct 2018 10:36:49 GMT Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2120.oracle.com with ESMTP id 2n7vaq8q4u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 25 Oct 2018 10:36:49 +0000 Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w9PAalwJ007381 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 25 Oct 2018 10:36:48 GMT Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1gFd0R-0002KO-QD; Thu, 25 Oct 2018 03:36:47 -0700 Received: from userv0022.oracle.com ([156.151.31.74]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1gFd0P-0002K8-1m for ocfs2-devel@oss.oracle.com; Thu, 25 Oct 2018 03:36:45 -0700 Received: from userp2030.oracle.com (userp2030.oracle.com [156.151.31.89]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w9PAaiJB010513 (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 25 Oct 2018 10:36:44 GMT Received: from pps.filterd (userp2030.oracle.com [127.0.0.1]) by userp2030.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w9PAYo2E010365 for ; Thu, 25 Oct 2018 10:36:44 GMT Received: from huawei.com (szxga06-in.huawei.com [45.249.212.32]) by userp2030.oracle.com with ESMTP id 2nbc61r257-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Thu, 25 Oct 2018 10:36:44 +0000 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 6FB1ECEA4DEFF; Thu, 25 Oct 2018 18:36:38 +0800 (CST) Received: from [10.177.253.249] (10.177.253.249) by smtp.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.408.0; Thu, 25 Oct 2018 18:36:36 +0800 To: "akpm@linux-foundation.org" , "mark@fasheh.com" , Joel Becker , Junxiao Bi , Joseph Qi From: piaojun Message-ID: <5BD19CB1.3070202@huawei.com> Date: Thu, 25 Oct 2018 18:36:33 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 X-Originating-IP: [10.177.253.249] X-CFilter-Loop: Reflected X-CLX-Shades: MLX X-CLX-Response: 1TFkXGRsYEQpMehcYGh8RCllNF2dmchEKWUkXGnEaEBp3BhgTGHESGR4QGnc GGBoGGhEKWV4XaG55EQpJRhdFWEtJRk91WlhFTl9JXkNFRBl1T0sRCkNOF1l5eBIaQHNzEmNNa3 xeG0FhYB1SREBFT2IHG2BoGBpSEQpYXBcfBBoEGx8bB0gaSBwTSUwfBRsaBBsaGgQeEgQfEBseG h8aEQpeWRd+aBpschEKTVwXGR4TEQpMWhdoaU1NXREKQ1oXHh8EGB4TBBgbGAQZGBEKQl4XGxEK RF4XHREKREkXGBEKQkYXYXBIb254fm1fRkURCkJcFxoRCkJFF2ZcbHtwZGJ6EnxDEQpCThdsQkh ZUxpNZXh4HREKQkwXb0sZEhJEWXlbG18RCkJsF2MFQlJmQGJeWntSEQpCQBd6HFxQGhx4SWhNbx EKQlgXYn1veQFPGBlwcHsRClpYFxgRCnBoF2tmE3h4Hn0SSVhNEBoRCnBoF2BYX0xeZk8BbGhzE BoRCnBoF2RPen5EclwafFNuEBoRCnBoF3pnX19pZR8ZeE5uEBoRCnBoF2dQXn4bE1hSE2cFEBoR CnBsF2FJeUN6c0l4Z2xiEB4SEQptfhcaEQpYTRdLESA= X-PDR: PASS X-Source-IP: 45.249.212.32 X-ServerName: szxga06-in.huawei.com X-Proofpoint-SPF-Result: pass X-Proofpoint-SPF-Record: v=spf1 ip4:45.249.212.32 ip4:45.249.212.35 ip4:119.145.14.93 ip4:58.251.152.93 ip4:194.213.3.17 ip4:206.16.17.72 ip4:45.249.212.255 ip4:45.249.212.187/29 ip4:45.249.212.191 ip4:185.176.76.210 ~all X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9056 signatures=668683 X-Proofpoint-DMARC-Record: none X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=205 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=312 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810250095 X-Spam: Clean Cc: "ocfs2-devel@oss.oracle.com" Subject: [Ocfs2-devel] [PATCH 5/5] ocfs2/cluster: modify socket container macro to adapt IPv6 X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9056 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810250095 X-Virus-Scanned: ClamAV using ClamSMTP SC_NODEF_FMT, SC_NODEF_ARGS, SC_PRE_NODEF_ARGS only support IPv4. Add SC_IPV6_NODEF_FMT, SC_IPV6_NODEF_ARGS, SC_IPV6_PRE_NODEF_ARGS to adapt IPV6 node's log. Signed-off-by: Jun Piao --- fs/ocfs2/cluster/tcp.c | 127 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 93 insertions(+), 34 deletions(-) diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c index 31157a8..fcdfde7 100644 --- a/fs/ocfs2/cluster/tcp.c +++ b/fs/ocfs2/cluster/tcp.c @@ -79,6 +79,11 @@ &sc->sc_node->nd_ipv4_address, \ ntohs(sc->sc_node->nd_ipv4_port) +#define SC_IPV6_NODEF_FMT "node %s (num %u) at %pI6:%u" +#define SC_IPV6_NODEF_ARGS(sc) sc->sc_node->nd_name, sc->sc_node->nd_num, \ + sc->sc_node->nd_ipv6_address, \ + ntohs(sc->sc_node->nd_ipv6_port) + /* * In the following two log macros, the whitespace after the ',' just * before ##args is intentional. Otherwise, gcc 2.95 will eat the @@ -542,19 +547,30 @@ static void o2net_set_nn_state(struct o2net_node *nn, } if (was_valid && !valid) { - if (old_sc) - printk(KERN_NOTICE "o2net: No longer connected to " - SC_NODEF_FMT "\n", SC_NODEF_ARGS(old_sc)); + if (old_sc) { + if (old_sc->sc_node->nd_ipnet_type == IPV4_TYPE) + printk(KERN_NOTICE "o2net: No longer connected to " + SC_NODEF_FMT "\n", SC_NODEF_ARGS(old_sc)); + else + printk(KERN_NOTICE "o2net: No longer connected to " + SC_IPV6_NODEF_FMT "\n", SC_IPV6_NODEF_ARGS(old_sc)); + } o2net_complete_nodes_nsw(nn); } if (!was_valid && valid) { o2quo_conn_up(o2net_num_from_nn(nn)); cancel_delayed_work(&nn->nn_connect_expired); - printk(KERN_NOTICE "o2net: %s " SC_NODEF_FMT "\n", - o2nm_this_node() > sc->sc_node->nd_num ? - "Connected to" : "Accepted connection from", - SC_NODEF_ARGS(sc)); + if (sc->sc_node->nd_ipnet_type == IPV4_TYPE) + printk(KERN_NOTICE "o2net: %s " SC_NODEF_FMT "\n", + o2nm_this_node() > sc->sc_node->nd_num ? + "Connected to" : "Accepted connection from", + SC_NODEF_ARGS(sc)); + else + printk(KERN_NOTICE "o2net: %s " SC_IPV6_NODEF_FMT "\n", + o2nm_this_node() > sc->sc_node->nd_num ? + "Connected to" : "Accepted connection from", + SC_IPV6_NODEF_ARGS(sc)); } /* trigger the connecting worker func as long as we're not valid, @@ -642,9 +658,14 @@ static void o2net_state_change(struct sock *sk) o2net_sc_queue_work(sc, &sc->sc_connect_work); break; default: - printk(KERN_INFO "o2net: Connection to " SC_NODEF_FMT - " shutdown, state %d\n", - SC_NODEF_ARGS(sc), sk->sk_state); + if (sc->sc_node->nd_ipnet_type == IPV4_TYPE) + printk(KERN_INFO "o2net: Connection to " SC_NODEF_FMT + " shutdown, state %d\n", + SC_NODEF_ARGS(sc), sk->sk_state); + else + printk(KERN_INFO "o2net: Connection to " SC_IPV6_NODEF_FMT + " shutdown, state %d\n", + SC_IPV6_NODEF_ARGS(sc), sk->sk_state); o2net_sc_queue_work(sc, &sc->sc_shutdown_work); break; } @@ -961,13 +982,21 @@ static void o2net_sendpage(struct o2net_sock_container *sc, if (ret == size) break; if (ret == (ssize_t)-EAGAIN) { - mlog(0, "sendpage of size %zu to " SC_NODEF_FMT - " returned EAGAIN\n", size, SC_NODEF_ARGS(sc)); + if (sc->sc_node->nd_ipnet_type == IPV4_TYPE) + mlog(0, "sendpage of size %zu to " SC_NODEF_FMT + " returned EAGAIN\n", size, SC_NODEF_ARGS(sc)); + else + mlog(0, "sendpage of size %zu to " SC_IPV6_NODEF_FMT + " returned EAGAIN\n", size, SC_IPV6_NODEF_ARGS(sc)); cond_resched(); continue; } - mlog(ML_ERROR, "sendpage of size %zu to " SC_NODEF_FMT - " failed with %zd\n", size, SC_NODEF_ARGS(sc), ret); + if (sc->sc_node->nd_ipnet_type == IPV4_TYPE) + mlog(ML_ERROR, "sendpage of size %zu to " SC_NODEF_FMT + " failed with %zd\n", size, SC_NODEF_ARGS(sc), ret); + else + mlog(ML_ERROR, "sendpage of size %zu to " SC_IPV6_NODEF_FMT + " failed with %zd\n", size, SC_IPV6_NODEF_ARGS(sc), ret); o2net_ensure_shutdown(nn, sc, 0); break; } @@ -1275,11 +1304,18 @@ static int o2net_check_handshake(struct o2net_sock_container *sc) struct o2net_node *nn = o2net_nn_from_num(sc->sc_node->nd_num); if (hand->protocol_version != cpu_to_be64(O2NET_PROTOCOL_VERSION)) { - printk(KERN_NOTICE "o2net: " SC_NODEF_FMT " Advertised net " - "protocol version %llu but %llu is required. " - "Disconnecting.\n", SC_NODEF_ARGS(sc), - (unsigned long long)be64_to_cpu(hand->protocol_version), - O2NET_PROTOCOL_VERSION); + if (sc->sc_node->nd_ipnet_type == IPV4_TYPE) + printk(KERN_NOTICE "o2net: " SC_NODEF_FMT " Advertised net " + "protocol version %llu but %llu is required. " + "Disconnecting.\n", SC_NODEF_ARGS(sc), + (unsigned long long)be64_to_cpu(hand->protocol_version), + O2NET_PROTOCOL_VERSION); + else + printk(KERN_NOTICE "o2net: " SC_IPV6_NODEF_FMT " Advertised net " + "protocol version %llu but %llu is required. " + "Disconnecting.\n", SC_IPV6_NODEF_ARGS(sc), + (unsigned long long)be64_to_cpu(hand->protocol_version), + O2NET_PROTOCOL_VERSION); /* don't bother reconnecting if its the wrong version. */ o2net_ensure_shutdown(nn, sc, -ENOTCONN); @@ -1293,22 +1329,36 @@ static int o2net_check_handshake(struct o2net_sock_container *sc) */ if (be32_to_cpu(hand->o2net_idle_timeout_ms) != o2net_idle_timeout()) { - printk(KERN_NOTICE "o2net: " SC_NODEF_FMT " uses a network " - "idle timeout of %u ms, but we use %u ms locally. " - "Disconnecting.\n", SC_NODEF_ARGS(sc), - be32_to_cpu(hand->o2net_idle_timeout_ms), - o2net_idle_timeout()); + if (sc->sc_node->nd_ipnet_type == IPV4_TYPE) + printk(KERN_NOTICE "o2net: " SC_NODEF_FMT " uses a network " + "idle timeout of %u ms, but we use %u ms locally. " + "Disconnecting.\n", SC_NODEF_ARGS(sc), + be32_to_cpu(hand->o2net_idle_timeout_ms), + o2net_idle_timeout()); + else + printk(KERN_NOTICE "o2net: " SC_IPV6_NODEF_FMT " uses a network " + "idle timeout of %u ms, but we use %u ms locally. " + "Disconnecting.\n", SC_IPV6_NODEF_ARGS(sc), + be32_to_cpu(hand->o2net_idle_timeout_ms), + o2net_idle_timeout()); o2net_ensure_shutdown(nn, sc, -ENOTCONN); return -1; } if (be32_to_cpu(hand->o2net_keepalive_delay_ms) != o2net_keepalive_delay()) { - printk(KERN_NOTICE "o2net: " SC_NODEF_FMT " uses a keepalive " - "delay of %u ms, but we use %u ms locally. " - "Disconnecting.\n", SC_NODEF_ARGS(sc), - be32_to_cpu(hand->o2net_keepalive_delay_ms), - o2net_keepalive_delay()); + if (sc->sc_node->nd_ipnet_type == IPV4_TYPE) + printk(KERN_NOTICE "o2net: " SC_NODEF_FMT " uses a keepalive " + "delay of %u ms, but we use %u ms locally. " + "Disconnecting.\n", SC_NODEF_ARGS(sc), + be32_to_cpu(hand->o2net_keepalive_delay_ms), + o2net_keepalive_delay()); + else + printk(KERN_NOTICE "o2net: " SC_IPV6_NODEF_FMT " uses a keepalive " + "delay of %u ms, but we use %u ms locally. " + "Disconnecting.\n", SC_IPV6_NODEF_ARGS(sc), + be32_to_cpu(hand->o2net_keepalive_delay_ms), + o2net_keepalive_delay()); o2net_ensure_shutdown(nn, sc, -ENOTCONN); return -1; } @@ -1528,9 +1578,14 @@ static void o2net_idle_timer(struct timer_list *t) unsigned long msecs = o2net_idle_timeout(); #endif - printk(KERN_NOTICE "o2net: Connection to " SC_NODEF_FMT " has been " - "idle for %lu.%lu secs.\n", - SC_NODEF_ARGS(sc), msecs / 1000, msecs % 1000); + if (sc->sc_node->nd_ipnet_type == IPV4_TYPE) + printk(KERN_NOTICE "o2net: Connection to " SC_NODEF_FMT " has been " + "idle for %lu.%lu secs.\n", + SC_NODEF_ARGS(sc), msecs / 1000, msecs % 1000); + else + printk(KERN_NOTICE "o2net: Connection to " SC_IPV6_NODEF_FMT " has been " + "idle for %lu.%lu secs.\n", + SC_IPV6_NODEF_ARGS(sc), msecs / 1000, msecs % 1000); /* idle timerout happen, don't shutdown the connection, but * make fence decision. Maybe the connection can recover before @@ -1710,8 +1765,12 @@ static void o2net_start_connect(struct work_struct *work) out: if (ret && sc) { - printk(KERN_NOTICE "o2net: Connect attempt to " SC_NODEF_FMT - " failed with errno %d\n", SC_NODEF_ARGS(sc), ret); + if (sc->sc_node->nd_ipnet_type == IPV4_TYPE) + printk(KERN_NOTICE "o2net: Connect attempt to " SC_NODEF_FMT + " failed with errno %d\n", SC_NODEF_ARGS(sc), ret); + else + printk(KERN_NOTICE "o2net: Connect attempt to " SC_IPV6_NODEF_FMT + " failed with errno %d\n", SC_IPV6_NODEF_ARGS(sc), ret); /* 0 err so that another will be queued and attempted * from set_nn_state */ o2net_ensure_shutdown(nn, sc, 0);