All of lore.kernel.org
 help / color / mirror / Atom feed
From: shencanquan <shencanquan@huawei.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH] ocfs2: dlmlock_master should return DLM_NORMAL after adding lock to blocked list
Date: Fri, 21 Jun 2013 09:30:50 +0800	[thread overview]
Message-ID: <51C3ACCA.6080005@huawei.com> (raw)
In-Reply-To: <51C2E3F1.5020605@huawei.com>

it is fine. because when the lock add to the block list.
it should be return DLM_NORMAL.

Reviewed-by: jensen <shencanquan@huawei.com>
On 2013/6/20 19:13, Xue jiufei wrote:

> Function dlmlock_master() returns DLM_RECOVERING/DLM_MIGRATING/
> DLM_FORWAR after adding lock to blocked list if lockres has the state
> DLM_LOCK_RES_RECOVERING/DLM_LOCK_RES_MIGRATING/
> DLM_LOCK_RES_IN_PROGRESS. so it will retry in dlmlock(). And this may
> cause dlm_thread fall into an infinite loop
> 
> 	Thread1                                  dlm_thread
> calls dlm_lock->dlmlock_master,				     
> if lockresA is in state
> DLM_LOCK_RES_RECOVERING, calls
> __dlm_wait_on_lockres() and waits
> until others threads clear this
> state; 
> 
> If cannot grant this lock,
> adding lock to blocked list,
> and return DLM_RECOVERING;	
> 
>                                         Grant this lock and move it to
>                                         grant list;
> 
> After a while, retry and 
> calls list_add_tail(), adding lock
> to blocked list again. 
> 
> Granted and blocked list of this lockres will become the following
> conditions:
>     lock_res->granted.next = dlm_lock->list_head;
>     lock_res->blocked.next = dlm_lock->list_head;
>     dlm_lock->list_head.next = dlm_lock_resource->blocked;
> When dlm_thread traverses the granted list, it will fall into an
> endless loop, checking dlm_lock.list_head, dlm_lock->list_head.next
> (i.e.lock_res->blocked), lock_res->blocked.next(i.e.dlm_lock.list_head
> again) .....					
> 
> Signed-off-by: joyce <xuejiufei@huawei.com>
> ---
>  fs/ocfs2/dlm/dlmlock.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/ocfs2/dlm/dlmlock.c b/fs/ocfs2/dlm/dlmlock.c
> index 975810b..47e67c2 100644
> --- a/fs/ocfs2/dlm/dlmlock.c
> +++ b/fs/ocfs2/dlm/dlmlock.c
> @@ -178,6 +178,7 @@ static enum dlm_status dlmlock_master(struct dlm_ctxt *dlm,
>  				     lock->ml.node);
>  			}
>  		} else {
> +			status = DLM_NORMAL;
>  			dlm_lock_get(lock);
>  			list_add_tail(&lock->list, &res->blocked);
>  			kick_thread = 1;

  reply	other threads:[~2013-06-21  1:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-20 11:13 [Ocfs2-devel] [PATCH] ocfs2: dlmlock_master should return DLM_NORMAL after adding lock to blocked list Xue jiufei
2013-06-21  1:30 ` shencanquan [this message]
2013-06-23 10:39 ` Jeff Liu
2013-06-28 20:47   ` Andrew Morton
2013-06-28 22:06     ` Sunil Mushran

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=51C3ACCA.6080005@huawei.com \
    --to=shencanquan@huawei.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.