From patchwork Thu Oct 25 10:35:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: piaojun X-Patchwork-Id: 10655701 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 BF10C13B5 for ; Thu, 25 Oct 2018 10:36:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9AFE2866D for ; Thu, 25 Oct 2018 10:36:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A915286D4; Thu, 25 Oct 2018 10:36:10 +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 userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 00F342866D for ; Thu, 25 Oct 2018 10:36:09 +0000 (UTC) Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w9PAYOcV173827; Thu, 25 Oct 2018 10:36:02 GMT Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2n7usugrtq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 25 Oct 2018 10:36:02 +0000 Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w9PAa1fI005535 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 25 Oct 2018 10:36:01 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 1gFczh-0002IB-L9; Thu, 25 Oct 2018 03:36:01 -0700 Received: from aserv0021.oracle.com ([141.146.126.233]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1gFczg-0002Hw-95 for ocfs2-devel@oss.oracle.com; Thu, 25 Oct 2018 03:36:00 -0700 Received: from userp2030.oracle.com (userp2030.oracle.com [156.151.31.89]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w9PAZxN1019967 (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 25 Oct 2018 10:36:00 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 w9PAY5Cu009736 for ; Thu, 25 Oct 2018 10:35:59 GMT Received: from huawei.com (szxga06-in.huawei.com [45.249.212.32]) by userp2030.oracle.com with ESMTP id 2nbc61r1q7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Thu, 25 Oct 2018 10:35:59 +0000 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id CC8FD39A5341; Thu, 25 Oct 2018 18:35:53 +0800 (CST) Received: from [10.177.253.249] (10.177.253.249) by smtp.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.408.0; Thu, 25 Oct 2018 18:35:53 +0800 To: "akpm@linux-foundation.org" , "mark@fasheh.com" , Joel Becker , Junxiao Bi , Joseph Qi From: piaojun Message-ID: <5BD19C86.1090805@huawei.com> Date: Thu, 25 Oct 2018 18:35:50 +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 GGBoGGhEKWV4XaG55EQpJRhdFWEtJRk91WlhFTl9JXkNFRBl1T0sRCkNOF3VHeV9dcGFvRUt8fG 59YkJNHn9wQHJ8Z21GemBOQWYYEQpYXBcfBBoEGx8bB0gaSBwTSUwfBRsaBBsaGgQeEgQfEBseG h8aEQpeWRd+aBpvWxEKTVwXGRgZEQpMWhdoaU1NXREKQ1oXHh8EGB4TBBgbGAQZGBEKQl4XGxEK RF4XHREKREkXGBEKQkYXYkR7Xn1NTH9sU2URCkJcFxoRCkJFF2ZcbHtwZGJ6EnxDEQpCThdsQkh ZUxpNZXh4HREKQkwXb0sZEhJEWXlbG18RCkJsF2MFQlJmQGJeWntSEQpCQBdgWV9ucnJlfWZ5XB EKQlgXYn1veQFPGBlwcHsRClpYFxgRCnBoF2Z+HlhBWwFpT2VrEBoRCnBoF2dgbW9FH29pBWdhE BoRCnBoF2hkQh5aQ2NgBW5yEBoRCnBoF2l9eU1EchJhXlhOEBoRCnBoF2UFTWBhSXlvYnBMEBoR 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=2 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 4/5] ocfs2/dlm: modify DLM_QUERY_NODEINFO message to adapt IPv6 node 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 Add IPv6 node info to dlm_query_nodeinfo, and distinguish with IPv4 by qn_ipnet_type. DLM_QUERY_NODEINFO message is compitibile with the old version. Signed-off-by: Jun Piao --- fs/ocfs2/cluster/tcp.c | 6 ++-- fs/ocfs2/cluster/tcp.h | 2 +- fs/ocfs2/dlm/dlmcommon.h | 12 +++++-- fs/ocfs2/dlm/dlmdomain.c | 93 ++++++++++++++++++++++++++++++++++-------------- 4 files changed, 80 insertions(+), 33 deletions(-) diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c index 82fa8da..31157a8 100644 --- a/fs/ocfs2/cluster/tcp.c +++ b/fs/ocfs2/cluster/tcp.c @@ -409,7 +409,7 @@ static void sc_kref_release(struct kref *kref) o2net_debug_del_sc(sc); if (sc->sc_page) - __free_page(sc->sc_page); + __free_pages(sc->sc_page, 1); kfree(sc); } @@ -429,7 +429,7 @@ static struct o2net_sock_container *sc_alloc(struct o2nm_node *node) struct page *page = NULL; int status = 0; - page = alloc_page(GFP_NOFS); + page = alloc_pages(GFP_NOFS, 1); sc = kzalloc(sizeof(*sc), GFP_NOFS); if (sc == NULL || page == NULL) goto out; @@ -462,7 +462,7 @@ static struct o2net_sock_container *sc_alloc(struct o2nm_node *node) out: if (page) - __free_page(page); + __free_pages(page, 1); kfree(sc); return ret; diff --git a/fs/ocfs2/cluster/tcp.h b/fs/ocfs2/cluster/tcp.h index c571e84..002b267 100644 --- a/fs/ocfs2/cluster/tcp.h +++ b/fs/ocfs2/cluster/tcp.h @@ -55,7 +55,7 @@ typedef int (o2net_msg_handler_func)(struct o2net_msg *msg, u32 len, void *data, typedef void (o2net_post_msg_handler_func)(int status, void *data, void *ret_data); -#define O2NET_MAX_PAYLOAD_BYTES (4096 - sizeof(struct o2net_msg)) +#define O2NET_MAX_PAYLOAD_BYTES (4096 * 2 - sizeof(struct o2net_msg)) /* same as hb delay, we're waiting for another node to recognize our hb */ #define O2NET_RECONNECT_DELAY_MS_DEFAULT 2000 diff --git a/fs/ocfs2/dlm/dlmcommon.h b/fs/ocfs2/dlm/dlmcommon.h index d06e27e..ba391ec 100644 --- a/fs/ocfs2/dlm/dlmcommon.h +++ b/fs/ocfs2/dlm/dlmcommon.h @@ -747,15 +747,21 @@ struct dlm_query_region { struct dlm_node_info { u8 ni_nodenum; u8 pad1; - __be16 ni_ipv4_port; - __be32 ni_ipv4_address; + union { + __be16 ni_ipv4_port; + __be16 ni_ipv6_port; + } ip_port; + union { + __be32 ni_ipv4_address; + u8 ni_ipv6_address[16]; + } ip_addr; }; struct dlm_query_nodeinfo { u8 qn_nodenum; u8 qn_numnodes; u8 qn_namelen; - u8 pad1; + u8 qn_ipnet_type; /* 0-IPv4, 1-IPv6 */ u8 qn_domain[O2NM_MAX_NAME_LEN]; struct dlm_node_info qn_nodes[O2NM_MAX_NODES]; }; diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c index 2acd58b..49d60a9 100644 --- a/fs/ocfs2/dlm/dlmdomain.c +++ b/fs/ocfs2/dlm/dlmdomain.c @@ -1176,10 +1176,16 @@ static int dlm_match_nodes(struct dlm_ctxt *dlm, struct dlm_query_nodeinfo *qn) int i, j; int status = 0; - for (j = 0; j < qn->qn_numnodes; ++j) - mlog(0, "Node %3d, %pI4:%u\n", qn->qn_nodes[j].ni_nodenum, - &(qn->qn_nodes[j].ni_ipv4_address), - ntohs(qn->qn_nodes[j].ni_ipv4_port)); + if (qn->qn_ipnet_type == IPV4_TYPE) + for (j = 0; j < qn->qn_numnodes; ++j) + mlog(0, "Node %3d, %pI4:%u\n", qn->qn_nodes[j].ni_nodenum, + &(qn->qn_nodes[j].ip_addr.ni_ipv4_address), + ntohs(qn->qn_nodes[j].ip_port.ni_ipv4_port)); + else + for (j = 0; j < qn->qn_numnodes; ++j) + mlog(0, "Node %3d, %pI6:%u\n", qn->qn_nodes[j].ni_nodenum, + qn->qn_nodes[j].ip_addr.ni_ipv6_address, + ntohs(qn->qn_nodes[j].ip_port.ni_ipv6_port)); for (i = 0; i < O2NM_MAX_NODES && !status; ++i) { local = o2nm_get_node_by_num(i); @@ -1198,27 +1204,53 @@ static int dlm_match_nodes(struct dlm_ctxt *dlm, struct dlm_query_nodeinfo *qn) status = -EINVAL; if (!status && - ((remote->ni_nodenum != local->nd_num) || - (remote->ni_ipv4_port != local->nd_ipv4_port) || - (remote->ni_ipv4_address != local->nd_ipv4_address))) + (remote->ni_nodenum != local->nd_num)) + status = -EINVAL; + + if (!status && (local->nd_ipnet_type == IPV4_TYPE) && + ((remote->ip_port.ni_ipv4_port != local->nd_ipv4_port) || + (remote->ip_addr.ni_ipv4_address != local->nd_ipv4_address))) + status = -EINVAL; + else if (!status && (local->nd_ipnet_type == IPV6_TYPE) && + ((remote->ip_port.ni_ipv6_port != local->nd_ipv6_port) || + memcmp(remote->ip_addr.ni_ipv6_address, local->nd_ipv6_address, + sizeof(local->nd_ipv6_address)))) status = -EINVAL; if (status) { - if (remote && !local) - mlog(ML_ERROR, "Domain %s: Node %d (%pI4:%u) " - "registered in joining node %d but not in " - "local node %d\n", qn->qn_domain, - remote->ni_nodenum, - &(remote->ni_ipv4_address), - ntohs(remote->ni_ipv4_port), - qn->qn_nodenum, dlm->node_num); - if (local && !remote) - mlog(ML_ERROR, "Domain %s: Node %d (%pI4:%u) " - "registered in local node %d but not in " - "joining node %d\n", qn->qn_domain, - local->nd_num, &(local->nd_ipv4_address), - ntohs(local->nd_ipv4_port), - dlm->node_num, qn->qn_nodenum); + if (local->nd_ipnet_type == IPV4_TYPE) { + if (remote && !local) + mlog(ML_ERROR, "Domain %s: Node %d (%pI4:%u) " + "registered in joining node %d but not in " + "local node %d\n", qn->qn_domain, + remote->ni_nodenum, + &(remote->ip_addr.ni_ipv4_address), + ntohs(remote->ip_port.ni_ipv4_port), + qn->qn_nodenum, dlm->node_num); + if (local && !remote) + mlog(ML_ERROR, "Domain %s: Node %d (%pI4:%u) " + "registered in local node %d but not in " + "joining node %d\n", qn->qn_domain, + local->nd_num, &(local->nd_ipv4_address), + ntohs(local->nd_ipv4_port), + dlm->node_num, qn->qn_nodenum); + } else { + if (remote && !local) + mlog(ML_ERROR, "Domain %s: Node %d (%pI6:%u) " + "registered in joining node %d but not in " + "local node %d\n", qn->qn_domain, + remote->ni_nodenum, + remote->ip_addr.ni_ipv6_address, + ntohs(remote->ip_port.ni_ipv6_port), + qn->qn_nodenum, dlm->node_num); + if (local && !remote) + mlog(ML_ERROR, "Domain %s: Node %d (%pI6:%u) " + "registered in local node %d but not in " + "joining node %d\n", qn->qn_domain, + local->nd_num, local->nd_ipv6_address, + ntohs(local->nd_ipv6_port), + dlm->node_num, qn->qn_nodenum); + } BUG_ON((!local && !remote)); } @@ -1249,11 +1281,20 @@ static int dlm_send_nodeinfo(struct dlm_ctxt *dlm, unsigned long *node_map) node = o2nm_get_node_by_num(i); if (!node) continue; + qn->qn_ipnet_type = node->nd_ipnet_type; qn->qn_nodes[count].ni_nodenum = node->nd_num; - qn->qn_nodes[count].ni_ipv4_port = node->nd_ipv4_port; - qn->qn_nodes[count].ni_ipv4_address = node->nd_ipv4_address; - mlog(0, "Node %3d, %pI4:%u\n", node->nd_num, - &(node->nd_ipv4_address), ntohs(node->nd_ipv4_port)); + if (qn->qn_ipnet_type == IPV4_TYPE) { + qn->qn_nodes[count].ip_port.ni_ipv4_port = node->nd_ipv4_port; + qn->qn_nodes[count].ip_addr.ni_ipv4_address = node->nd_ipv4_address; + mlog(0, "Node %3d, %pI4:%u\n", node->nd_num, + &(node->nd_ipv4_address), ntohs(node->nd_ipv4_port)); + } else { + qn->qn_nodes[count].ip_port.ni_ipv6_port = node->nd_ipv6_port; + memcpy(qn->qn_nodes[count].ip_addr.ni_ipv6_address, + node->nd_ipv6_address, sizeof(node->nd_ipv6_address)); + mlog(0, "Node %3d, %pI6:%u\n", node->nd_num, + node->nd_ipv6_address, ntohs(node->nd_ipv6_port)); + } ++count; o2nm_node_put(node); }