All of lore.kernel.org
 help / color / mirror / Atom feed
From: Goldwyn Rodrigues <rgoldwyn@suse.de>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 6/6] Use the new DLM operation callbacks while requesting new lockspace
Date: Sun, 03 Nov 2013 21:48:14 -0600	[thread overview]
Message-ID: <527718FE.3050903@suse.de> (raw)
In-Reply-To: <20131104011209.GN29346@wotan.suse.de>

On 11/03/2013 07:12 PM, Mark Fasheh wrote:
> On Fri, Oct 18, 2013 at 09:46:31AM -0500, Goldwyn Rodrigues wrote:
>> Attempt to use the new DLM operations. If it is not supported,
>> use the traditional ocfs2_controld.
>>
>> To exchange ocfs2 versioning, we use the LVB of the version dlm lock.
>> It first attempts to take the lock in EX mode (non-blocking). If
>> successful (which means it is the first mount), it writes the
>> version number and downconverts to PR lock. If it is unsuccessful,
>> it reads the version from the lock.
>>
>> If this becomes the standard (wit o2cb as well), it could
>> simplify userspace tools to check if the filesystem is mounted
>> on other nodes.
>>
>> Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
>> ---
>>   fs/ocfs2/stack_user.c | 97 ++++++++++++++++++++++++++++++++++++++-------------
>>   1 file changed, 73 insertions(+), 24 deletions(-)
>
>
>> @@ -948,12 +961,65 @@ static int user_cluster_connect(struct ocfs2_cluster_connection *conn)
>>   		goto out;
>>   	}
>>
>> -	lc->oc_type = WITH_CONTROLD;
>> +	init_waitqueue_head(&lc->oc_wait);
>> +	init_completion(&lc->oc_sync_wait);
>> +	atomic_set(&lc->oc_this_node, 0);
>> +	conn->cc_private = lc;
>> +	lc->oc_type = NO_CONTROLD;
>> +
>> +	rc = dlm_new_lockspace(conn->cc_name, conn->cc_cluster_name,
>> +			       DLM_LSFL_FS, DLM_LVB_LEN,
>> +			       &ocfs2_ls_ops, conn, &ops_rv, &fsdlm);
>> +	if (rc)
>> +		goto out;
>> +
>> +	if (ops_rv == -EOPNOTSUPP) {
>> +		lc->oc_type = WITH_CONTROLD;
>> +		printk(KERN_NOTICE "ocfs2: You seem to be using an older "
>> +				"version of dlm_controld and/or ocfs2-tools."
>> +				" Please consider upgrading.\n");
>> +	} else if (ops_rv) {
>> +		rc = ops_rv;
>> +		goto out;
>> +	}
>> +	conn->cc_lockspace = fsdlm;
>>
>>   	rc = ocfs2_live_connection_new(conn, lc);
>>   	if (rc)
>>   		goto out;
>>
>> +	if (lc->oc_type == NO_CONTROLD) {
>> +		int ret;
>> +		lc->oc_version_lksb.sb_lvbptr = lc->oc_lvb;
>> +		ret = version_lock(conn, DLM_LOCK_EX,
>> +				DLM_LKF_VALBLK|DLM_LKF_NOQUEUE);
>> +		running_proto.pv_major =
>> +			ocfs2_user_plugin.sp_max_proto.pv_major;
>> +		running_proto.pv_minor =
>> +			ocfs2_user_plugin.sp_max_proto.pv_minor;
>> +		if (!ret) {
>> +			conn->cc_version.pv_major = running_proto.pv_major;
>> +			conn->cc_version.pv_minor = running_proto.pv_minor;
>> +			version_to_lvb(&running_proto, lc->oc_lvb);
>> +			version_lock(conn, DLM_LOCK_PR, DLM_LKF_CONVERT|DLM_LKF_VALBLK);
>> +		} else if (ret == -EAGAIN) {
>> +			version_lock(conn, DLM_LOCK_PR, DLM_LKF_VALBLK);
>> +			ret = lvb_to_version(lc->oc_lvb, &conn->cc_version);
>> +			if (ret) {
>> +				rc = ret;
>> +				user_cluster_disconnect(conn);
>> +				goto out;
>> +			}
>> +		} else {
>> +			printk(KERN_ERR "ocfs2: Could not determine"
>> +					" locking version\n");
>> +			rc = ret;
>> +			user_cluster_disconnect(conn);
>> +			goto out;
>> +		}
>> +		wait_event(lc->oc_wait, (atomic_read(&lc->oc_this_node) > 0));
>> +	}
>> +
>
> Can we put this block in it's own function?

Yes. Sure.

I suppose thats about it. I will incorporate these changes and put them 
in the next series.


-- 
Goldwyn

  reply	other threads:[~2013-11-04  3:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-18 14:46 [Ocfs2-devel] [PATCH 6/6] Use the new DLM operation callbacks while requesting new lockspace Goldwyn Rodrigues
2013-11-04  1:12 ` Mark Fasheh
2013-11-04  3:48   ` Goldwyn Rodrigues [this message]
2013-11-04 22:15     ` Mark Fasheh
  -- strict thread matches above, loose matches on Subject: below --
2013-11-12 14:08 Goldwyn Rodrigues
2013-12-08 19:30 ` Mark Fasheh
2013-12-09 19:42 Goldwyn Rodrigues

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=527718FE.3050903@suse.de \
    --to=rgoldwyn@suse.de \
    --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.