All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wengang Wang <wen.gang.wang@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 8/8] ocfs2/dlm: Add message DLM_QUERY_NODEINFO
Date: Thu, 29 Jul 2010 14:49:36 +0800	[thread overview]
Message-ID: <20100729064936.GD2591@laptop.jp.oracle.com> (raw)
In-Reply-To: <1279929322-9276-9-git-send-email-sunil.mushran@oracle.com>

On 10-07-23 16:55, Sunil Mushran wrote:
> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
> ---
>  fs/ocfs2/dlm/dlmcommon.h |   17 ++++
>  fs/ocfs2/dlm/dlmdomain.c |  188 +++++++++++++++++++++++++++++++++++++++++++++-
>  2 files changed, 204 insertions(+), 1 deletions(-)
> 
> +	for (i = 0; i < O2NM_MAX_NODES && !status; ++i) {
> +		local = o2nm_get_node_by_num(i);
> +		remote = NULL;
> +		for (j = 0; j < qn->qn_numnodes; ++j) {
> +			if (qn->qn_nodes[j].ni_nodenum == i) {
> +				remote = &(qn->qn_nodes[j]);
> +				break;
> +			}
> +		}
> +
> +		if (!local && !remote)
> +			continue;
> +
> +		if ((local && !remote) || (!local && remote))
> +			status = -EINVAL;
> +
> +		if (!status &&
> +		    ((remote->ni_nodenum != local->nd_num) ||

ni_nodenum already checked in the for loop.
> +		     (remote->ni_ipv4_port != local->nd_ipv4_port) ||
> +		     (remote->ni_ipv4_address != local->nd_ipv4_address)))
> +			status = -EINVAL;
> +

> +static int dlm_send_nodeinfo(struct dlm_ctxt *dlm, unsigned long *node_map)
> +{
> +	struct dlm_query_nodeinfo *qn = NULL;
> +	struct o2nm_node *node;
> +	int ret = 0, status, count, i;
> +
> +	if (find_next_bit(node_map, O2NM_MAX_NODES, 0) >= O2NM_MAX_NODES)
> +		goto bail;
> +
> +	qn = kmalloc(sizeof(struct dlm_query_nodeinfo), GFP_KERNEL);
> +	if (!qn) {
> +		ret = -ENOMEM;
> +		mlog_errno(ret);
> +		goto bail;
> +	}
> +
> +	memset(qn, 0, sizeof(struct dlm_query_nodeinfo));

Any reason we are not using kzalloc() here and in dlm_send_hbregions()?

> +	for (i = 0, count = 0; i < O2NM_MAX_NODES; ++i) {
> +		node = o2nm_get_node_by_num(i);
> +		if (!node)
> +			continue;
> +		qn->qn_nodes[count].ni_nodenum = node->nd_num;
> +		qn->qn_nodes[count].ni_ipv4_port = node->nd_ipv4_port;
> +

> +static int dlm_query_nodeinfo_handler(struct o2net_msg *msg, u32 len,
> +				      void *data, void **ret_data)
> +{
> +	struct dlm_query_nodeinfo *qn;
> +	struct dlm_ctxt *dlm = NULL;
> +	int locked = 0, status = 0;
> +
> +	qn = (struct dlm_query_nodeinfo *) msg->buf;
> +
> +	mlog(ML_NOTICE, "Node %u queries nodes on domain %s\n",
> +	     qn->qn_nodenum, qn->qn_domain);
> +
> +	status = -EINVAL;

how about remove this line and

+	int locked = 0, status = -EINVAL;

regards,
wengang.
> +
> +	spin_lock(&dlm_domain_lock);
> +	dlm = __dlm_lookup_domain_full(qn->qn_domain, qn->qn_namelen);
> +	if (!dlm) {
> +		mlog(ML_ERROR, "Node %d queried nodes on domain %s before "
> +		     "join domain\n", qn->qn_nodenum, qn->qn_domain);
> +		goto bail;
> +	}
> +

  reply	other threads:[~2010-07-29  6:49 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-23 23:55 [Ocfs2-devel] Global heartbeat - drop#1 Sunil Mushran
2010-07-23 23:55 ` [Ocfs2-devel] [PATCH 1/8] ocfs2/cluster: Add heartbeat mode configfs parameter Sunil Mushran
2010-07-23 23:55 ` [Ocfs2-devel] [PATCH 2/8] ocfs2: Add an incompat feature flag OCFS2_FEATURE_INCOMPAT_CLUSTERINFO Sunil Mushran
2010-07-23 23:55 ` [Ocfs2-devel] [PATCH 3/8] ocfs2: Add support for heartbeat=global mount option Sunil Mushran
2010-07-23 23:55 ` [Ocfs2-devel] [PATCH 4/8] ocfs2/dlm: Expose dlm_protocol in dlm_state Sunil Mushran
2010-07-23 23:55 ` [Ocfs2-devel] [PATCH 5/8] ocfs2/cluster: Get all heartbeat regions Sunil Mushran
2010-07-23 23:55 ` [Ocfs2-devel] [PATCH 6/8] ocfs2/dlm: Add message DLM_QUERY_HBREGION Sunil Mushran
2010-07-28 16:21   ` Wengang Wang
2010-07-28 16:47     ` Sunil Mushran
2010-07-29  5:03       ` Wengang Wang
2010-07-29 17:22         ` Sunil Mushran
2010-07-30  1:55           ` Wengang Wang
2010-07-29  5:08   ` Wengang Wang
2010-07-29 17:24     ` Sunil Mushran
2010-07-23 23:55 ` [Ocfs2-devel] [PATCH 7/8] ocfs2: Print message if user mounts without starting global heartbeat Sunil Mushran
2010-07-23 23:55 ` [Ocfs2-devel] [PATCH 8/8] ocfs2/dlm: Add message DLM_QUERY_NODEINFO Sunil Mushran
2010-07-29  6:49   ` Wengang Wang [this message]
2010-07-29 18:59     ` Sunil Mushran
2010-07-28 14:45 ` [Ocfs2-devel] Global heartbeat - drop#1 Wengang Wang
2010-07-28 16:40   ` Sunil Mushran
2010-07-29  3:08     ` Wengang Wang
2010-07-29 17:28       ` Sunil Mushran
2010-07-30  1:58         ` Wengang Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100729064936.GD2591@laptop.jp.oracle.com \
    --to=wen.gang.wang@oracle.com \
    --cc=ocfs2-devel@oss.oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.