* [Ocfs2-devel] [PATCH] ocfs2: dlmlock_master should return DLM_NORMAL after adding lock to blocked list
@ 2013-06-20 11:13 Xue jiufei
2013-06-21 1:30 ` shencanquan
2013-06-23 10:39 ` Jeff Liu
0 siblings, 2 replies; 5+ messages in thread
From: Xue jiufei @ 2013-06-20 11:13 UTC (permalink / raw)
To: ocfs2-devel
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;
--
1.7.9.7
^ permalink raw reply related [flat|nested] 5+ messages in thread* [Ocfs2-devel] [PATCH] ocfs2: dlmlock_master should return DLM_NORMAL after adding lock to blocked list 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 2013-06-23 10:39 ` Jeff Liu 1 sibling, 0 replies; 5+ messages in thread From: shencanquan @ 2013-06-21 1:30 UTC (permalink / raw) To: ocfs2-devel 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; ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Ocfs2-devel] [PATCH] ocfs2: dlmlock_master should return DLM_NORMAL after adding lock to blocked list 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 @ 2013-06-23 10:39 ` Jeff Liu 2013-06-28 20:47 ` Andrew Morton 1 sibling, 1 reply; 5+ messages in thread From: Jeff Liu @ 2013-06-23 10:39 UTC (permalink / raw) To: ocfs2-devel Hi Jiufei, On 06/20/2013 07:13 PM, 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) ..... Thanks for your nice description of this problem and this fix looks good. Let's waiting for an ACK from either Sunil, Mark or Joel. -Jeff > > 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; ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Ocfs2-devel] [PATCH] ocfs2: dlmlock_master should return DLM_NORMAL after adding lock to blocked list 2013-06-23 10:39 ` Jeff Liu @ 2013-06-28 20:47 ` Andrew Morton 2013-06-28 22:06 ` Sunil Mushran 0 siblings, 1 reply; 5+ messages in thread From: Andrew Morton @ 2013-06-28 20:47 UTC (permalink / raw) To: ocfs2-devel On Sun, 23 Jun 2013 18:39:16 +0800 Jeff Liu <jeff.liu@oracle.com> wrote: > Hi Jiufei, > > On 06/20/2013 07:13 PM, 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) ..... > > Thanks for your nice description of this problem and this fix looks good. > Let's waiting for an ACK from either Sunil, Mark or Joel. Still waiting ;) From: Xue jiufei <xuejiufei@huawei.com> Subject: ocfs2: dlmlock_master() should return DLM_NORMAL after adding lock to blocked list 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> Reviewed-by: jensen <shencanquan@huawei.com> Cc: Jeff Liu <jeff.liu@oracle.com> Cc: Sunil Mushran <sunil.mushran@gmail.com> Cc: Mark Fasheh <mfasheh@suse.com> Cc: Joel Becker <jlbec@evilplan.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> --- fs/ocfs2/dlm/dlmlock.c | 1 + 1 file changed, 1 insertion(+) 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 --- a/fs/ocfs2/dlm/dlmlock.c~ocfs2-dlmlock_master-should-return-dlm_normal-after-adding-lock-to-blocked-list +++ a/fs/ocfs2/dlm/dlmlock.c @@ -178,6 +178,7 @@ static enum dlm_status dlmlock_master(st lock->ml.node); } } else { + status = DLM_NORMAL; dlm_lock_get(lock); list_add_tail(&lock->list, &res->blocked); kick_thread = 1; _ ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Ocfs2-devel] [PATCH] ocfs2: dlmlock_master should return DLM_NORMAL after adding lock to blocked list 2013-06-28 20:47 ` Andrew Morton @ 2013-06-28 22:06 ` Sunil Mushran 0 siblings, 0 replies; 5+ messages in thread From: Sunil Mushran @ 2013-06-28 22:06 UTC (permalink / raw) To: ocfs2-devel Acked-by: Sunil Mushran <sunil.mushran@gmail.com> On Fri, Jun 28, 2013 at 1:47 PM, Andrew Morton <akpm@linux-foundation.org>wrote: > On Sun, 23 Jun 2013 18:39:16 +0800 Jeff Liu <jeff.liu@oracle.com> wrote: > > > Hi Jiufei, > > > > On 06/20/2013 07:13 PM, 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) ..... > > > > Thanks for your nice description of this problem and this fix looks good. > > Let's waiting for an ACK from either Sunil, Mark or Joel. > > Still waiting ;) > > > From: Xue jiufei <xuejiufei@huawei.com> > Subject: ocfs2: dlmlock_master() should return DLM_NORMAL after adding > lock to blocked list > > 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> > Reviewed-by: jensen <shencanquan@huawei.com> > Cc: Jeff Liu <jeff.liu@oracle.com> > Cc: Sunil Mushran <sunil.mushran@gmail.com> > Cc: Mark Fasheh <mfasheh@suse.com> > Cc: Joel Becker <jlbec@evilplan.org> > Signed-off-by: Andrew Morton <akpm@linux-foundation.org> > --- > > fs/ocfs2/dlm/dlmlock.c | 1 + > 1 file changed, 1 insertion(+) > > 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 > --- > a/fs/ocfs2/dlm/dlmlock.c~ocfs2-dlmlock_master-should-return-dlm_normal-after-adding-lock-to-blocked-list > +++ a/fs/ocfs2/dlm/dlmlock.c > @@ -178,6 +178,7 @@ static enum dlm_status dlmlock_master(st > lock->ml.node); > } > } else { > + status = DLM_NORMAL; > dlm_lock_get(lock); > list_add_tail(&lock->list, &res->blocked); > kick_thread = 1; > _ > > > _______________________________________________ > Ocfs2-devel mailing list > Ocfs2-devel at oss.oracle.com > https://oss.oracle.com/mailman/listinfo/ocfs2-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://oss.oracle.com/pipermail/ocfs2-devel/attachments/20130628/45bdce64/attachment.html ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-06-28 22:06 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 2013-06-23 10:39 ` Jeff Liu 2013-06-28 20:47 ` Andrew Morton 2013-06-28 22:06 ` Sunil Mushran
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.