<div dir="ltr">Acked-by: Sunil Mushran <<a href="mailto:sunil.mushran@gmail.com">sunil.mushran@gmail.com</a>><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jun 28, 2013 at 1:47 PM, Andrew Morton <span dir="ltr"><<a href="mailto:akpm@linux-foundation.org" target="_blank">akpm@linux-foundation.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Sun, 23 Jun 2013 18:39:16 +0800 Jeff Liu <<a href="mailto:jeff.liu@oracle.com">jeff.liu@oracle.com</a>> wrote:<br>
<br>
> Hi Jiufei,<br>
><br>
> On 06/20/2013 07:13 PM, Xue jiufei wrote:<br>
><br>
> > Function dlmlock_master() returns DLM_RECOVERING/DLM_MIGRATING/<br>
> > DLM_FORWAR after adding lock to blocked list if lockres has the state<br>
> > DLM_LOCK_RES_RECOVERING/DLM_LOCK_RES_MIGRATING/<br>
> > DLM_LOCK_RES_IN_PROGRESS. so it will retry in dlmlock(). And this may<br>
> > cause dlm_thread fall into an infinite loop<br>
> ><br>
> > Thread1 dlm_thread<br>
> > calls dlm_lock->dlmlock_master,<br>
> > if lockresA is in state<br>
> > DLM_LOCK_RES_RECOVERING, calls<br>
> > __dlm_wait_on_lockres() and waits<br>
> > until others threads clear this<br>
> > state;<br>
> ><br>
> > If cannot grant this lock,<br>
> > adding lock to blocked list,<br>
> > and return DLM_RECOVERING;<br>
> ><br>
> > Grant this lock and move it to<br>
> > grant list;<br>
> ><br>
> > After a while, retry and<br>
> > calls list_add_tail(), adding lock<br>
> > to blocked list again.<br>
> ><br>
> > Granted and blocked list of this lockres will become the following<br>
> > conditions:<br>
> > lock_res->granted.next = dlm_lock->list_head;<br>
> > lock_res->blocked.next = dlm_lock->list_head;<br>
> > dlm_lock->list_head.next = dlm_lock_resource->blocked;<br>
> > When dlm_thread traverses the granted list, it will fall into an<br>
> > endless loop, checking dlm_lock.list_head, dlm_lock->list_head.next<br>
> > (i.e.lock_res->blocked), lock_res->blocked.next(i.e.dlm_lock.list_head<br>
> > again) .....<br>
><br>
> Thanks for your nice description of this problem and this fix looks good.<br>
> Let's waiting for an ACK from either Sunil, Mark or Joel.<br>
<br>
</div></div>Still waiting ;)<br>
<br>
<br>
From: Xue jiufei <<a href="mailto:xuejiufei@huawei.com">xuejiufei@huawei.com</a>><br>
Subject: ocfs2: dlmlock_master() should return DLM_NORMAL after adding lock to blocked list<br>
<div><div class="h5"><br>
dlmlock_master() returns DLM_RECOVERING/DLM_MIGRATING/ DLM_FORWAR after<br>
adding lock to blocked list if lockres has the state<br>
DLM_LOCK_RES_RECOVERING/DLM_LOCK_RES_MIGRATING/ DLM_LOCK_RES_IN_PROGRESS.<br>
so it will retry in dlmlock(). And this may cause dlm_thread fall into an<br>
infinite loop<br>
<br>
Thread1 dlm_thread<br>
calls dlm_lock->dlmlock_master,<br>
if lockresA is in state<br>
DLM_LOCK_RES_RECOVERING, calls<br>
__dlm_wait_on_lockres() and waits<br>
until others threads clear this<br>
state;<br>
<br>
If cannot grant this lock,<br>
adding lock to blocked list,<br>
and return DLM_RECOVERING;<br>
<br>
Grant this lock and move it to<br>
grant list;<br>
<br>
After a while, retry and<br>
calls list_add_tail(), adding lock<br>
to blocked list again.<br>
<br>
Granted and blocked list of this lockres will become the following<br>
conditions:<br>
<br>
lock_res->granted.next = dlm_lock->list_head;<br>
lock_res->blocked.next = dlm_lock->list_head;<br>
dlm_lock->list_head.next = dlm_lock_resource->blocked;<br>
<br>
When dlm_thread traverses the granted list, it will fall into an endless<br>
loop, checking dlm_lock.list_head, dlm_lock->list_head.next<br>
(i.e.lock_res->blocked), lock_res->blocked.next(i.e.dlm_lock.list_head<br>
again) .....<br>
<br>
</div></div>Signed-off-by: joyce <<a href="mailto:xuejiufei@huawei.com">xuejiufei@huawei.com</a>><br>
Reviewed-by: jensen <<a href="mailto:shencanquan@huawei.com">shencanquan@huawei.com</a>><br>
Cc: Jeff Liu <<a href="mailto:jeff.liu@oracle.com">jeff.liu@oracle.com</a>><br>
Cc: Sunil Mushran <<a href="mailto:sunil.mushran@gmail.com">sunil.mushran@gmail.com</a>><br>
Cc: Mark Fasheh <<a href="mailto:mfasheh@suse.com">mfasheh@suse.com</a>><br>
Cc: Joel Becker <<a href="mailto:jlbec@evilplan.org">jlbec@evilplan.org</a>><br>
Signed-off-by: Andrew Morton <<a href="mailto:akpm@linux-foundation.org">akpm@linux-foundation.org</a>><br>
<div class="im">---<br>
<br>
fs/ocfs2/dlm/dlmlock.c | 1 +<br>
1 file changed, 1 insertion(+)<br>
<br>
</div>diff -puN fs/ocfs2/dlm/dlmlock.c~ocfs2-dlmlock_master-should-return-dlm_normal-after-adding-lock-to-blocked-list fs/ocfs2/dlm/dlmlock.c<br>
--- a/fs/ocfs2/dlm/dlmlock.c~ocfs2-dlmlock_master-should-return-dlm_normal-after-adding-lock-to-blocked-list<br>
<div class="im HOEnZb">+++ a/fs/ocfs2/dlm/dlmlock.c<br>
@@ -178,6 +178,7 @@ static enum dlm_status dlmlock_master(st<br>
</div><div class="HOEnZb"><div class="h5"> lock->ml.node);<br>
}<br>
} else {<br>
+ status = DLM_NORMAL;<br>
dlm_lock_get(lock);<br>
list_add_tail(&lock->list, &res->blocked);<br>
kick_thread = 1;<br>
_<br>
<br>
<br>
_______________________________________________<br>
Ocfs2-devel mailing list<br>
<a href="mailto:Ocfs2-devel@oss.oracle.com">Ocfs2-devel@oss.oracle.com</a><br>
<a href="https://oss.oracle.com/mailman/listinfo/ocfs2-devel" target="_blank">https://oss.oracle.com/mailman/listinfo/ocfs2-devel</a><br>
</div></div></blockquote></div><br></div>