Commit 29576f8b authored by Sunil Mushran's avatar Sunil Mushran Committed by Mark Fasheh

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: default avatarSunil Mushran <sunil.mushran@oracle.com>
Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
parent 724bdca9
...@@ -101,6 +101,7 @@ struct dlm_ctxt ...@@ -101,6 +101,7 @@ struct dlm_ctxt
struct list_head purge_list; struct list_head purge_list;
struct list_head pending_asts; struct list_head pending_asts;
struct list_head pending_basts; struct list_head pending_basts;
struct list_head tracking_list;
unsigned int purge_count; unsigned int purge_count;
spinlock_t spinlock; spinlock_t spinlock;
spinlock_t ast_lock; spinlock_t ast_lock;
...@@ -270,6 +271,9 @@ struct dlm_lock_resource ...@@ -270,6 +271,9 @@ struct dlm_lock_resource
struct list_head dirty; struct list_head dirty;
struct list_head recovering; // dlm_recovery_ctxt.resources list struct list_head recovering; // dlm_recovery_ctxt.resources list
/* Added during init and removed during release */
struct list_head tracking; /* dlm->tracking_list */
/* unused lock resources have their last_used stamped and are /* unused lock resources have their last_used stamped and are
* put on a list for the dlm thread to run. */ * put on a list for the dlm thread to run. */
unsigned long last_used; unsigned long last_used;
......
...@@ -644,6 +644,7 @@ int dlm_shutting_down(struct dlm_ctxt *dlm) ...@@ -644,6 +644,7 @@ int dlm_shutting_down(struct dlm_ctxt *dlm)
void dlm_unregister_domain(struct dlm_ctxt *dlm) void dlm_unregister_domain(struct dlm_ctxt *dlm)
{ {
int leave = 0; int leave = 0;
struct dlm_lock_resource *res;
spin_lock(&dlm_domain_lock); spin_lock(&dlm_domain_lock);
BUG_ON(dlm->dlm_state != DLM_CTXT_JOINED); BUG_ON(dlm->dlm_state != DLM_CTXT_JOINED);
...@@ -673,6 +674,15 @@ void dlm_unregister_domain(struct dlm_ctxt *dlm) ...@@ -673,6 +674,15 @@ void dlm_unregister_domain(struct dlm_ctxt *dlm)
msleep(500); msleep(500);
mlog(0, "%s: more migration to do\n", dlm->name); mlog(0, "%s: more migration to do\n", dlm->name);
} }
/* This list should be empty. If not, print remaining lockres */
if (!list_empty(&dlm->tracking_list)) {
mlog(ML_ERROR, "Following lockres' are still on the "
"tracking list:\n");
list_for_each_entry(res, &dlm->tracking_list, tracking)
dlm_print_one_lock_resource(res);
}
dlm_mark_domain_leaving(dlm); dlm_mark_domain_leaving(dlm);
dlm_leave_domain(dlm); dlm_leave_domain(dlm);
dlm_complete_dlm_shutdown(dlm); dlm_complete_dlm_shutdown(dlm);
...@@ -1526,6 +1536,7 @@ static struct dlm_ctxt *dlm_alloc_ctxt(const char *domain, ...@@ -1526,6 +1536,7 @@ static struct dlm_ctxt *dlm_alloc_ctxt(const char *domain,
INIT_LIST_HEAD(&dlm->reco.node_data); INIT_LIST_HEAD(&dlm->reco.node_data);
INIT_LIST_HEAD(&dlm->purge_list); INIT_LIST_HEAD(&dlm->purge_list);
INIT_LIST_HEAD(&dlm->dlm_domain_handlers); INIT_LIST_HEAD(&dlm->dlm_domain_handlers);
INIT_LIST_HEAD(&dlm->tracking_list);
dlm->reco.state = 0; dlm->reco.state = 0;
INIT_LIST_HEAD(&dlm->pending_asts); INIT_LIST_HEAD(&dlm->pending_asts);
......
...@@ -639,6 +639,14 @@ static void dlm_lockres_release(struct kref *kref) ...@@ -639,6 +639,14 @@ static void dlm_lockres_release(struct kref *kref)
mlog(0, "destroying lockres %.*s\n", res->lockname.len, mlog(0, "destroying lockres %.*s\n", res->lockname.len,
res->lockname.name); res->lockname.name);
if (!list_empty(&res->tracking))
list_del_init(&res->tracking);
else {
mlog(ML_ERROR, "Resource %.*s not on the Tracking list\n",
res->lockname.len, res->lockname.name);
dlm_print_one_lock_resource(res);
}
if (!hlist_unhashed(&res->hash_node) || if (!hlist_unhashed(&res->hash_node) ||
!list_empty(&res->granted) || !list_empty(&res->granted) ||
!list_empty(&res->converting) || !list_empty(&res->converting) ||
...@@ -706,6 +714,7 @@ static void dlm_init_lockres(struct dlm_ctxt *dlm, ...@@ -706,6 +714,7 @@ static void dlm_init_lockres(struct dlm_ctxt *dlm,
INIT_LIST_HEAD(&res->dirty); INIT_LIST_HEAD(&res->dirty);
INIT_LIST_HEAD(&res->recovering); INIT_LIST_HEAD(&res->recovering);
INIT_LIST_HEAD(&res->purge); INIT_LIST_HEAD(&res->purge);
INIT_LIST_HEAD(&res->tracking);
atomic_set(&res->asts_reserved, 0); atomic_set(&res->asts_reserved, 0);
res->migration_pending = 0; res->migration_pending = 0;
res->inflight_locks = 0; res->inflight_locks = 0;
...@@ -721,6 +730,8 @@ static void dlm_init_lockres(struct dlm_ctxt *dlm, ...@@ -721,6 +730,8 @@ static void dlm_init_lockres(struct dlm_ctxt *dlm,
res->last_used = 0; res->last_used = 0;
list_add_tail(&res->tracking, &dlm->tracking_list);
memset(res->lvb, 0, DLM_LVB_LEN); memset(res->lvb, 0, DLM_LVB_LEN);
memset(res->refmap, 0, sizeof(res->refmap)); memset(res->refmap, 0, sizeof(res->refmap));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment