OpenCloudOS-Kernel/fs/ocfs2/dlm
Xue jiufei 096b2ef83c 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>
Acked-by: 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>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-03 16:07:24 -07:00
..
Makefile fs: change to new flag variable 2011-03-17 14:02:57 +01:00
dlmapi.h ocfs2/trivial: Remove trailing whitespaces 2010-01-25 19:20:51 -08:00
dlmast.c ocfs2: trivial endianness misannotations 2012-05-29 23:28:34 -04:00
dlmcommon.h ocfs2: trivial endianness misannotations 2012-05-29 23:28:34 -04:00
dlmconvert.c ocfs2: Remove ENTRY from masklog. 2011-02-21 11:10:44 +08:00
dlmconvert.h
dlmdebug.c fs: add export.h to files using EXPORT_SYMBOL/THIS_MODULE macros 2011-10-31 19:30:31 -04:00
dlmdebug.h ocfs2/dlm: Cleanup dlmdebug.c 2010-12-22 18:34:44 -08:00
dlmdomain.c ocfs2: remove kfree() redundant null checks 2013-02-21 17:22:19 -08:00
dlmdomain.h
dlmlock.c ocfs2: dlmlock_master() should return DLM_NORMAL after adding lock to blocked list 2013-07-03 16:07:24 -07:00
dlmmaster.c ocfs2/dlm: use GFP_ATOMIC inside a spin_lock 2013-02-26 02:46:13 -05:00
dlmrecovery.c ocfs2: add missing dlm_put() in dlm_begin_reco_handler() 2013-07-03 16:07:23 -07:00
dlmthread.c ocfs2/dlm: Take inflight reference count for remotely mastered resources too 2011-07-24 10:29:54 -07:00
dlmunlock.c ocfs2: Remove ENTRY from masklog. 2011-02-21 11:10:44 +08:00
dlmver.c ocfs2: bump version number 2008-01-25 15:05:46 -08:00
dlmver.h