OSDN Git Service

ocfs2/dlm: remove potential deadlock -V3
authorWengang Wang <wen.gang.wang@oracle.com>
Fri, 30 Jul 2010 15:18:00 +0000 (23:18 +0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 26 Aug 2010 23:45:47 +0000 (16:45 -0700)
commit7b5b07e30b8341d54c1f311772c9183eaa1cfa7a
tree4bd28e1ba1639e8bdcecdf862e6bf53c358a2996
parentd79caba7b9f51221576fb4afe7dc0e165bdd0485
ocfs2/dlm: remove potential deadlock -V3

commit b11f1f1ab73fd358b1b734a9427744802202ba68 upstream.

When we need to take both dlm_domain_lock and dlm->spinlock, we should take
them in order of: dlm_domain_lock then dlm->spinlock.

There is pathes disobey this order. That is calling dlm_lockres_put() with
dlm->spinlock held in dlm_run_purge_list. dlm_lockres_put() calls dlm_put() at
the ref and dlm_put() locks on dlm_domain_lock.

Fix:
Don't grab/put the dlm when the initialising/releasing lockres.
That grab is not required because we don't call dlm_unregister_domain()
based on refcount.

Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/ocfs2/dlm/dlmmaster.c