Skip to content

Commit

Permalink
ocfs2/dlm: remove potential deadlock -V3
Browse files Browse the repository at this point in the history
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>
Cc: stable@kernel.org
Signed-off-by: Joel Becker <joel.becker@oracle.com>
  • Loading branch information
Wengang Wang authored and Joel Becker committed Aug 7, 2010
1 parent a524812 commit b11f1f1
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions fs/ocfs2/dlm/dlmmaster.c
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,6 @@ static void dlm_lockres_release(struct kref *kref)

atomic_dec(&dlm->res_cur_count);

dlm_put(dlm);

if (!hlist_unhashed(&res->hash_node) ||
!list_empty(&res->granted) ||
!list_empty(&res->converting) ||
Expand Down Expand Up @@ -585,8 +583,6 @@ static void dlm_init_lockres(struct dlm_ctxt *dlm,
res->migration_pending = 0;
res->inflight_locks = 0;

/* put in dlm_lockres_release */
dlm_grab(dlm);
res->dlm = dlm;

kref_init(&res->refs);
Expand Down

0 comments on commit b11f1f1

Please sign in to comment.