aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2
diff options
context:
space:
mode:
authorKurt Hackel <kurt.hackel@oracle.com>2006-05-01 14:16:45 -0400
committerMark Fasheh <mark.fasheh@oracle.com>2006-06-26 17:43:00 -0400
commit8b2198097ae6a5b54ed92345989ec343070f916b (patch)
tree625f267987dfdb06f8ddfdec684c85d6d19cc6fa /fs/ocfs2
parent343e26a4007d14c2154c1d13d1209797dce5c535 (diff)
ocfs2: purge lockres' sooner
Immediately purge a lockress that the local node is not the master of. Signed-off-by: Kurt Hackel <kurt.hackel@oracle.com> Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r--fs/ocfs2/dlm/dlmthread.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/fs/ocfs2/dlm/dlmthread.c b/fs/ocfs2/dlm/dlmthread.c
index 71302b90daf5..76526ea95bb2 100644
--- a/fs/ocfs2/dlm/dlmthread.c
+++ b/fs/ocfs2/dlm/dlmthread.c
@@ -54,6 +54,8 @@
54#include "cluster/masklog.h" 54#include "cluster/masklog.h"
55 55
56static int dlm_thread(void *data); 56static int dlm_thread(void *data);
57static void dlm_purge_lockres_now(struct dlm_ctxt *dlm,
58 struct dlm_lock_resource *lockres);
57 59
58static void dlm_flush_asts(struct dlm_ctxt *dlm); 60static void dlm_flush_asts(struct dlm_ctxt *dlm);
59 61
@@ -111,10 +113,23 @@ void __dlm_lockres_calc_usage(struct dlm_ctxt *dlm,
111 res->last_used = jiffies; 113 res->last_used = jiffies;
112 list_add_tail(&res->purge, &dlm->purge_list); 114 list_add_tail(&res->purge, &dlm->purge_list);
113 dlm->purge_count++; 115 dlm->purge_count++;
116
117 /* if this node is not the owner, there is
118 * no way to keep track of who the owner could be.
119 * unhash it to avoid serious problems. */
120 if (res->owner != dlm->node_num) {
121 mlog(0, "%s:%.*s: doing immediate "
122 "purge of lockres owned by %u\n",
123 dlm->name, res->lockname.len,
124 res->lockname.name, res->owner);
125
126 dlm_purge_lockres_now(dlm, res);
127 }
114 } 128 }
115 } else if (!list_empty(&res->purge)) { 129 } else if (!list_empty(&res->purge)) {
116 mlog(0, "removing lockres %.*s from purge list\n", 130 mlog(0, "removing lockres %.*s from purge list, "
117 res->lockname.len, res->lockname.name); 131 "owner=%u\n", res->lockname.len, res->lockname.name,
132 res->owner);
118 133
119 list_del_init(&res->purge); 134 list_del_init(&res->purge);
120 dlm->purge_count--; 135 dlm->purge_count--;
@@ -180,6 +195,24 @@ finish:
180 __dlm_unhash_lockres(lockres); 195 __dlm_unhash_lockres(lockres);
181} 196}
182 197
198/* make an unused lockres go away immediately.
199 * as soon as the dlm spinlock is dropped, this lockres
200 * will not be found. kfree still happens on last put. */
201static void dlm_purge_lockres_now(struct dlm_ctxt *dlm,
202 struct dlm_lock_resource *lockres)
203{
204 assert_spin_locked(&dlm->spinlock);
205 assert_spin_locked(&lockres->spinlock);
206
207 BUG_ON(!__dlm_lockres_unused(lockres));
208
209 if (!list_empty(&lockres->purge)) {
210 list_del_init(&lockres->purge);
211 dlm->purge_count--;
212 }
213 __dlm_unhash_lockres(lockres);
214}
215
183static void dlm_run_purge_list(struct dlm_ctxt *dlm, 216static void dlm_run_purge_list(struct dlm_ctxt *dlm,
184 int purge_now) 217 int purge_now)
185{ 218{