All of lore.kernel.org
 help / color / mirror / Atom feed
From: Changwei Ge <ge.changwei@h3c.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH] ocfs2/dlm: return DLM_CANCELGRANT if the lock is on granted list and the operation is canceled
Date: Fri, 22 Feb 2019 03:32:51 +0000	[thread overview]
Message-ID: <63ADC13FD55D6546B7DECE290D39E3730127867D3A@H3CMLB14-EX.srv.huawei-3com.com> (raw)
In-Reply-To: 5C6F6967.1030608@huawei.com

Hi Jun,

On 2019/2/22 11:16, piaojun wrote:
> Hi Changwei,
> 
> On 2019/2/21 14:46, Changwei Ge wrote:
>> Hi jun
>> Good afternoon.
>>
>>>>>> If AST doesn't manage to get back to requested node, why must flag OCFS2_LOCK_BUSY be cleared in o2dlm_unlock_ast_wrapper?
>>>>>>
>>>>>> Yes, OCFS2_LOCK_BUSY can be cleared it either o2dlm_unlock_ast_wrapper() or o2dlm_lock_ast_wrapper() with o2cb stack applied.
>>>>>>
>>>>>> If we return DLM_CANCELGRANT from ocfs2/dlm to dlm, then we must know that AST has ever come back or master node has moved the lock to grant list itself, thus we clear flag OCFS2_LOCK_BUSY in o2dlm_lock_ast_wrapper().
>>>>>> Otherwise we ascertain that we can stop current ongoing locking procedure and must clear OCFS2_LOCK_BUSY in o2dlm_unlock_ast_wrapper() (*synchronized*).
>>>>>>
>>>>>> Let's summarize this, OCFS2_LOCK_BUSY should be cleared whether by locking success or cancellation success.
>>>>>>
>>>>>> And my way already check if the lock is granted then return DLM_CANCELGRANT or not.
>>>>>>
>>>>>
>>>>> OCFS2_LOCK_BUSY won't be cleared if DLM_CANCELGRANT is set in
>>>>> o2dlm_unlock_ast_wrapper, and that's what I'm concerned about:
>>>>
>>>> But we already *ascertain* that previous locking request has been *granted* before deciding to return DLM_CANCELGRANT during cancellation to o2dlm_unlock_ast_wrapper().
>>>>
>>>> If above condition stands, o2dlm_lock_ast_wrapper() must will be or have been called, which also clears OCFS2_LOCK_BUSY.
>>>>
>>>
>>> 1. Node1 already has PR lock, and wants to get ex.
>> Well, a locking up-conversion procedure.
>>
>>> 2. Node1 receive BAST and do unlock, here OCFS2_LOCK_BUSY is set.
>> Because there are two concurrent up-conversion, which conflict, so one of them must be canceled!
>>
>>> 3. Node1 can not receive the AST for unlock as master dead.
>> So here you mean the lock can't be granted.
>>
>>> 4. Then o2dlm_unlock_ast_wrapper will be called rather than o2dlm_lock_ast_wrapper.
>> Then the cancellation succeeds as the master dies.
>>
>>> 5. Actually the *granted* lock request has nothing to do with OCFS2_LOCK_BUSY.
>> Yes, o2dlm_lock_ast_wrapper will not clear OCFS2_LOCK_BUSY.
>>
>> But my suggestion was not against above timing sequence.
>> Did you misunderstand my suggestion?
>> And the original logic of Jian's patch also returns DLM_CANCELGRANT.
> 
> Yes, Jian's last patch can't solve the problem either, and I think we
> should find another solution for it. I'm considering deleting the check
> for DLM_CANCELGRANT, and clear OCFS2_LOCK_BUSY in the following process.

If Jian's patch can't fix the issue either, I am going to ask Andrew to drop this patch.
Hopefully, Jian or you can help post another patch for it. Then we can have another round of discussion.

Thanks,
Changwei

> 
> Thanks,
> Jun
> 
>>
>> Thanks,
>> Changwei
>>
>>
>>    
>>
>> .
>>
> 

  reply	other threads:[~2019-02-22  3:32 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-03 12:20 [Ocfs2-devel] [PATCH] ocfs2/dlm: return DLM_CANCELGRANT if the lock is on granted list and the operation is canceled wangjian
2018-12-05  1:49 ` Changwei Ge
2018-12-06 12:05   ` wangjian
2018-12-07  3:12     ` Changwei Ge
2018-12-08 10:05       ` wangjian
2019-02-14  9:04         ` piaojun
2019-02-14  9:59           ` Changwei Ge
2019-02-14 10:25             ` piaojun
2019-02-14 10:28               ` Changwei Ge
2019-02-14 10:13           ` Changwei Ge
2019-02-15  6:50             ` piaojun
2019-02-15  7:06               ` Changwei Ge
2019-02-15  7:35                 ` piaojun
2019-02-15  7:56                   ` Changwei Ge
2019-02-15  9:19                     ` piaojun
2019-02-15  9:27                       ` Changwei Ge
2019-02-15  9:48                         ` piaojun
2019-02-18  9:25                           ` Changwei Ge
2019-02-19  0:47                             ` piaojun
2019-02-19  2:38                               ` Changwei Ge
2019-02-19  8:26                                 ` piaojun
2019-02-21  6:46                                   ` Changwei Ge
2019-02-22  3:15                                     ` piaojun
2019-02-22  3:32                                       ` Changwei Ge [this message]
2019-02-22  3:34                                         ` piaojun

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=63ADC13FD55D6546B7DECE290D39E3730127867D3A@H3CMLB14-EX.srv.huawei-3com.com \
    --to=ge.changwei@h3c.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.