aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/dlm/dlmmaster.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2/dlm/dlmmaster.c')
-rw-r--r--fs/ocfs2/dlm/dlmmaster.c27
1 files changed, 7 insertions, 20 deletions
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
index acfc9288d5cd..d70cdd51de0f 100644
--- a/fs/ocfs2/dlm/dlmmaster.c
+++ b/fs/ocfs2/dlm/dlmmaster.c
@@ -517,15 +517,6 @@ static void dlm_set_lockres_owner(struct dlm_ctxt *dlm,
517{ 517{
518 assert_spin_locked(&res->spinlock); 518 assert_spin_locked(&res->spinlock);
519 519
520 mlog_entry("%.*s, %u\n", res->lockname.len, res->lockname.name, owner);
521
522 if (owner == dlm->node_num)
523 atomic_inc(&dlm->local_resources);
524 else if (owner == DLM_LOCK_RES_OWNER_UNKNOWN)
525 atomic_inc(&dlm->unknown_resources);
526 else
527 atomic_inc(&dlm->remote_resources);
528
529 res->owner = owner; 520 res->owner = owner;
530} 521}
531 522
@@ -534,17 +525,8 @@ void dlm_change_lockres_owner(struct dlm_ctxt *dlm,
534{ 525{
535 assert_spin_locked(&res->spinlock); 526 assert_spin_locked(&res->spinlock);
536 527
537 if (owner == res->owner) 528 if (owner != res->owner)
538 return; 529 dlm_set_lockres_owner(dlm, res, owner);
539
540 if (res->owner == dlm->node_num)
541 atomic_dec(&dlm->local_resources);
542 else if (res->owner == DLM_LOCK_RES_OWNER_UNKNOWN)
543 atomic_dec(&dlm->unknown_resources);
544 else
545 atomic_dec(&dlm->remote_resources);
546
547 dlm_set_lockres_owner(dlm, res, owner);
548} 530}
549 531
550 532
@@ -573,6 +555,8 @@ static void dlm_lockres_release(struct kref *kref)
573 } 555 }
574 spin_unlock(&dlm->track_lock); 556 spin_unlock(&dlm->track_lock);
575 557
558 atomic_dec(&dlm->res_cur_count);
559
576 dlm_put(dlm); 560 dlm_put(dlm);
577 561
578 if (!hlist_unhashed(&res->hash_node) || 562 if (!hlist_unhashed(&res->hash_node) ||
@@ -653,6 +637,9 @@ static void dlm_init_lockres(struct dlm_ctxt *dlm,
653 637
654 kref_init(&res->refs); 638 kref_init(&res->refs);
655 639
640 atomic_inc(&dlm->res_tot_count);
641 atomic_inc(&dlm->res_cur_count);
642
656 /* just for consistency */ 643 /* just for consistency */
657 spin_lock(&res->spinlock); 644 spin_lock(&res->spinlock);
658 dlm_set_lockres_owner(dlm, res, DLM_LOCK_RES_OWNER_UNKNOWN); 645 dlm_set_lockres_owner(dlm, res, DLM_LOCK_RES_OWNER_UNKNOWN);