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] [RFC] ocfs2/dlm: support range lock
Date: Fri, 30 Jan 2015 14:02:34 +0800	[thread overview]
Message-ID: <54CB1E7A.4020403@oracle.com> (raw)
In-Reply-To: <54CB0087.6020102@huawei.com>

Hi Wenfang,

? 2015?01?30? 11:54, yangwenfang ??:
> On 2015/1/29 16:06, Wengang Wang wrote:
>>> On 2015/1/29 8:05, Goldwyn Rodrigues wrote:
>>>> Hi Yangwenfang,
>>>>
>>>> I appreciate the effort in this regard.
>>>>
>>>> On 01/26/2015 06:28 AM, yangwenfang wrote:
>>>>> What:
>>>>> Byte range lock is applied to lock a region of a file to accelerate
>>>>> reading/writing concurrently.
>>>>> Each lock resource deploys an interval tree to manage the range, which
>>>>> supports basic operations like add, delete, insert, find, split and merge.
>>>>> The most important issue is to determine the existance of conflicts
>>>>> among the ranges. Conflict-free ranges of the same file can be accessed
>>>>> concurrently. In the contrary, nodes must wait for the release of a
>>>>> conflicted lock before accessing the range of file.
>>>>>
>>>>> Byte range lock supports split and merge rules: for same level, larger
>>>>> scope; different level, write > read(If a node keeps EX lock with
>>>>> range(start,end), then it has PR range lock(start,end)).
>>>>> For example:
>>>>> (1) merge: N1 keeps range lock (0,9)PR and (5,19)PR, the lock is merged into
>>>>> (0,19) PR;
>>>>> (2) merge: N1 keeps range lock (0,9)PR and (5,19)EX, the merged lock should
>>>>> become(0,19) PR, (5,19)EX;
>>>>> (3) split: N1 keeps range lock (0,9)PR, N2 tries to lock(0,5) PR, N1 should
>>>>> split the lock and keep (6,9)PR.
>>>> What is the purpose of doing this kind of merge/split? I assume this will be required in case of multiple processes from the same node read/write to the file. Would it not be simpler to not merge or split and keep separate instances in lock resources? This way you would have to do relatively lesser book keeping with respect to comparisons.
>>>>
>>> Hi,
>>> Realization of this kind of merge/split is for cache of range lock to support unlock-delay.
>>> For example(the granularity is block size)
>>> 1.Node 1 writes to 0-9, it will keep the range lock(0,9,EX) if no other node write the same range of file.
>>> 2.Node 1 writes to 10-19, then the range lock will be merged into (0,19,EX). if not, the number of locks will be more and more.
>>> 3.Node 1 writes to 5-10, then no need to dlmlock from master.
>>> 3.Node 2 writes to 5-10, conflict with Node 1, so Node 1 will drop (5,10), the range lock is splitted into (0,4) and (11,19).
>> What's the merge would be like in dlm module? Will it cause deadlock when
>> node1 extend 0-9 to 0-19  and node 2 extend 10-19 to 0-19?
>>
>> thanks,
>> wengang
>>
> Hi,
> Do you mean that:
> N1 keeps range lock(0,9), and wants to lock(10,19).
> N2 keeps range lock(10,19), and wants to lock(0,9).
>
> Firstly N1 sends locking message (10,19) to master, then master determines the existance of conflicts among the ranges.
> N1(10,19) is conflict with N2(10,19). So master sends bast message to N2.
> Sencond N2 sends locking message (0,9) to master, N1(0,9) is conflict with N2 (0,9), so master sends bast message to N1.
> N2 drops range lock(10,19), then N1 merges range lock into (0,19).
> N1 drops range lock (0,9), then N1 splits range lock into (10,19).
> Finally, N1 keeps range lock (10,19), N2 keeps range lock (0,9).
>
> So, there is no deadlock. Merging is only to the granted lock.
>
> But if N2 keeps range lock(10,19), and wants to lock(0,15), there is deadlock.
> When N2 drops range lock(10,19), (10,19) is conflict with another request (0,15), range lock (0,15) must be canceled

How you detect the deadlock and avoid it?
thanks,
wengang
> So, the most important issue is to determine the existance of conflicts among the ranges.
>
> thanks,
> yangwenfang
>
>

  reply	other threads:[~2015-01-30  6:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-26 12:28 [Ocfs2-devel] [RFC] ocfs2/dlm: support range lock yangwenfang
2015-01-27  7:08 ` Srinivas Eeda
2015-01-29  6:42   ` yangwenfang
2015-01-29 11:04     ` Goldwyn Rodrigues
2015-01-30  2:59       ` Xue jiufei
2015-01-30 12:37         ` Goldwyn Rodrigues
2015-01-31  4:15           ` yangwenfang
2015-01-29 11:07     ` Goldwyn Rodrigues
2015-01-29  0:05 ` Goldwyn Rodrigues
2015-01-29  3:21   ` Wengang Wang
2015-01-29  7:47   ` yangwenfang
2015-01-29  8:06     ` Wengang Wang
2015-01-30  3:54       ` yangwenfang
2015-01-30  6:02         ` Wengang Wang [this message]
2015-01-30  7:46           ` yangwenfang
2015-01-28  8:43 David Weber

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=54CB1E7A.4020403@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.