aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSunil Mushran <sunil.mushran@oracle.com>2008-03-10 18:16:21 -0400
committerMark Fasheh <mfasheh@suse.com>2008-04-18 11:56:08 -0400
commit29576f8bb54045be944ba809d4fca1ad77c94165 (patch)
tree9fd56f286df824a819e8fe44316076f55bfb2030 /fs
parent724bdca9b8449d9ee5f779dc27ee3d906a04508c (diff)
ocfs2/dlm: Link all lockres' to a tracking list
This patch links all the lockres' to a tracking list in dlm_ctxt. We will use this in an upcoming patch that will walk the entire list and to dump the lockres states to a debugfs file. Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com> Signed-off-by: Joel Becker <joel.becker@oracle.com> Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/ocfs2/dlm/dlmcommon.h4
-rw-r--r--fs/ocfs2/dlm/dlmdomain.c11
-rw-r--r--fs/ocfs2/dlm/dlmmaster.c11
3 files changed, 26 insertions, 0 deletions
diff --git a/fs/ocfs2/dlm/dlmcommon.h b/fs/ocfs2/dlm/dlmcommon.h
index 7525a8ae3943..cc31abeadb8e 100644
--- a/fs/ocfs2/dlm/dlmcommon.h
+++ b/fs/ocfs2/dlm/dlmcommon.h
@@ -101,6 +101,7 @@ struct dlm_ctxt
101 struct list_head purge_list; 101 struct list_head purge_list;
102 struct list_head pending_asts; 102 struct list_head pending_asts;
103 struct list_head pending_basts; 103 struct list_head pending_basts;
104 struct list_head tracking_list;
104 unsigned int purge_count; 105 unsigned int purge_count;
105 spinlock_t spinlock; 106 spinlock_t spinlock;
106 spinlock_t ast_lock; 107 spinlock_t ast_lock;
@@ -270,6 +271,9 @@ struct dlm_lock_resource
270 struct list_head dirty; 271 struct list_head dirty;
271 struct list_head recovering; // dlm_recovery_ctxt.resources list 272 struct list_head recovering; // dlm_recovery_ctxt.resources list
272 273
274 /* Added during init and removed during release */
275 struct list_head tracking; /* dlm->tracking_list */
276
273 /* unused lock resources have their last_used stamped and are 277 /* unused lock resources have their last_used stamped and are
274 * put on a list for the dlm thread to run. */ 278 * put on a list for the dlm thread to run. */
275 unsigned long last_used; 279 unsigned long last_used;
diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c
index b092364d0d52..4f7695c851ed 100644
--- a/fs/ocfs2/dlm/dlmdomain.c
+++ b/fs/ocfs2/dlm/dlmdomain.c
@@ -644,6 +644,7 @@ int dlm_shutting_down(struct dlm_ctxt *dlm)
644void dlm_unregister_domain(struct dlm_ctxt *dlm) 644void dlm_unregister_domain(struct dlm_ctxt *dlm)
645{ 645{
646 int leave = 0; 646 int leave = 0;
647 struct dlm_lock_resource *res;
647 648
648 spin_lock(&dlm_domain_lock); 649 spin_lock(&dlm_domain_lock);
649 BUG_ON(dlm->dlm_state != DLM_CTXT_JOINED); 650 BUG_ON(dlm->dlm_state != DLM_CTXT_JOINED);
@@ -673,6 +674,15 @@ void dlm_unregister_domain(struct dlm_ctxt *dlm)
673 msleep(500); 674 msleep(500);
674 mlog(0, "%s: more migration to do\n", dlm->name); 675 mlog(0, "%s: more migration to do\n", dlm->name);
675 } 676 }
677
678 /* This list should be empty. If not, print remaining lockres */
679 if (!list_empty(&dlm->tracking_list)) {
680 mlog(ML_ERROR, "Following lockres' are still on the "
681 "tracking list:\n");
682 list_for_each_entry(res, &dlm->tracking_list, tracking)
683 dlm_print_one_lock_resource(res);
684 }
685
676 dlm_mark_domain_leaving(dlm); 686 dlm_mark_domain_leaving(dlm);
677 dlm_leave_domain(dlm); 687 dlm_leave_domain(dlm);
678 dlm_complete_dlm_shutdown(dlm); 688 dlm_complete_dlm_shutdown(dlm);
@@ -1526,6 +1536,7 @@ static struct dlm_ctxt *dlm_alloc_ctxt(const char *domain,
1526 INIT_LIST_HEAD(&dlm->reco.node_data); 1536 INIT_LIST_HEAD(&dlm->reco.node_data);
1527 INIT_LIST_HEAD(&dlm->purge_list); 1537 INIT_LIST_HEAD(&dlm->purge_list);
1528 INIT_LIST_HEAD(&dlm->dlm_domain_handlers); 1538 INIT_LIST_HEAD(&dlm->dlm_domain_handlers);
1539 INIT_LIST_HEAD(&dlm->tracking_list);
1529 dlm->reco.state = 0; 1540 dlm->reco.state = 0;
1530 1541
1531 INIT_LIST_HEAD(&dlm->pending_asts); 1542 INIT_LIST_HEAD(&dlm->pending_asts);
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
index ac9ed31e5445..97133465891c 100644
--- a/fs/ocfs2/dlm/dlmmaster.c
+++ b/fs/ocfs2/dlm/dlmmaster.c
@@ -639,6 +639,14 @@ static void dlm_lockres_release(struct kref *kref)
639 mlog(0, "destroying lockres %.*s\n", res->lockname.len, 639 mlog(0, "destroying lockres %.*s\n", res->lockname.len,
640 res->lockname.name); 640 res->lockname.name);
641 641
642 if (!list_empty(&res->tracking))
643 list_del_init(&res->tracking);
644 else {
645 mlog(ML_ERROR, "Resource %.*s not on the Tracking list\n",
646 res->lockname.len, res->lockname.name);
647 dlm_print_one_lock_resource(res);
648 }
649
642 if (!hlist_unhashed(&res->hash_node) || 650 if (!hlist_unhashed(&res->hash_node) ||
643 !list_empty(&res->granted) || 651 !list_empty(&res->granted) ||
644 !list_empty(&res->converting) || 652 !list_empty(&res->converting) ||
@@ -706,6 +714,7 @@ static void dlm_init_lockres(struct dlm_ctxt *dlm,
706 INIT_LIST_HEAD(&res->dirty); 714 INIT_LIST_HEAD(&res->dirty);
707 INIT_LIST_HEAD(&res->recovering); 715 INIT_LIST_HEAD(&res->recovering);
708 INIT_LIST_HEAD(&res->purge); 716 INIT_LIST_HEAD(&res->purge);
717 INIT_LIST_HEAD(&res->tracking);
709 atomic_set(&res->asts_reserved, 0); 718 atomic_set(&res->asts_reserved, 0);
710 res->migration_pending = 0; 719 res->migration_pending = 0;
711 res->inflight_locks = 0; 720 res->inflight_locks = 0;
@@ -721,6 +730,8 @@ static void dlm_init_lockres(struct dlm_ctxt *dlm,
721 730
722 res->last_used = 0; 731 res->last_used = 0;
723 732
733 list_add_tail(&res->tracking, &dlm->tracking_list);
734
724 memset(res->lvb, 0, DLM_LVB_LEN); 735 memset(res->lvb, 0, DLM_LVB_LEN);
725 memset(res->refmap, 0, sizeof(res->refmap)); 736 memset(res->refmap, 0, sizeof(res->refmap));
726} 737}