aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSunil Mushran <sunil.mushran@oracle.com>2011-07-24 13:25:54 -0400
committerSunil Mushran <sunil.mushran@oracle.com>2011-07-24 13:25:54 -0400
commit0afbba13226fcdbd4327f6b13a42f6efbb8c9caf (patch)
tree4ed7ddff738f162ef5b6403df87847931eaf0d43 /fs
parent394eb3d38a3ecc549cc34a3040103a9164be516b (diff)
ocfs2/dlm: Cleanup up dlm_finish_local_lockres_recovery()
dlm_finish_local_lockres_recovery() needed a facelift. Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/ocfs2/dlm/dlmrecovery.c57
1 files changed, 25 insertions, 32 deletions
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
index a3c312c43b90..41e74f0e2d35 100644
--- a/fs/ocfs2/dlm/dlmrecovery.c
+++ b/fs/ocfs2/dlm/dlmrecovery.c
@@ -2093,6 +2093,9 @@ static void dlm_finish_local_lockres_recovery(struct dlm_ctxt *dlm,
2093 2093
2094 list_for_each_entry_safe(res, next, &dlm->reco.resources, recovering) { 2094 list_for_each_entry_safe(res, next, &dlm->reco.resources, recovering) {
2095 if (res->owner == dead_node) { 2095 if (res->owner == dead_node) {
2096 mlog(0, "%s: res %.*s, Changing owner from %u to %u\n",
2097 dlm->name, res->lockname.len, res->lockname.name,
2098 res->owner, new_master);
2096 list_del_init(&res->recovering); 2099 list_del_init(&res->recovering);
2097 spin_lock(&res->spinlock); 2100 spin_lock(&res->spinlock);
2098 /* new_master has our reference from 2101 /* new_master has our reference from
@@ -2114,40 +2117,30 @@ static void dlm_finish_local_lockres_recovery(struct dlm_ctxt *dlm,
2114 for (i = 0; i < DLM_HASH_BUCKETS; i++) { 2117 for (i = 0; i < DLM_HASH_BUCKETS; i++) {
2115 bucket = dlm_lockres_hash(dlm, i); 2118 bucket = dlm_lockres_hash(dlm, i);
2116 hlist_for_each_entry(res, hash_iter, bucket, hash_node) { 2119 hlist_for_each_entry(res, hash_iter, bucket, hash_node) {
2117 if (res->state & DLM_LOCK_RES_RECOVERING) { 2120 if (!(res->state & DLM_LOCK_RES_RECOVERING))
2118 if (res->owner == dead_node) { 2121 continue;
2119 mlog(0, "(this=%u) res %.*s owner=%u "
2120 "was not on recovering list, but "
2121 "clearing state anyway\n",
2122 dlm->node_num, res->lockname.len,
2123 res->lockname.name, new_master);
2124 } else if (res->owner == dlm->node_num) {
2125 mlog(0, "(this=%u) res %.*s owner=%u "
2126 "was not on recovering list, "
2127 "owner is THIS node, clearing\n",
2128 dlm->node_num, res->lockname.len,
2129 res->lockname.name, new_master);
2130 } else
2131 continue;
2132 2122
2133 if (!list_empty(&res->recovering)) { 2123 if (res->owner != dead_node &&
2134 mlog(0, "%s:%.*s: lockres was " 2124 res->owner != dlm->node_num)
2135 "marked RECOVERING, owner=%u\n", 2125 continue;
2136 dlm->name, res->lockname.len, 2126
2137 res->lockname.name, res->owner); 2127 if (!list_empty(&res->recovering)) {
2138 list_del_init(&res->recovering); 2128 list_del_init(&res->recovering);
2139 dlm_lockres_put(res); 2129 dlm_lockres_put(res);
2140 }
2141 spin_lock(&res->spinlock);
2142 /* new_master has our reference from
2143 * the lock state sent during recovery */
2144 dlm_change_lockres_owner(dlm, res, new_master);
2145 res->state &= ~DLM_LOCK_RES_RECOVERING;
2146 if (__dlm_lockres_has_locks(res))
2147 __dlm_dirty_lockres(dlm, res);
2148 spin_unlock(&res->spinlock);
2149 wake_up(&res->wq);
2150 } 2130 }
2131
2132 /* new_master has our reference from
2133 * the lock state sent during recovery */
2134 mlog(0, "%s: res %.*s, Changing owner from %u to %u\n",
2135 dlm->name, res->lockname.len, res->lockname.name,
2136 res->owner, new_master);
2137 spin_lock(&res->spinlock);
2138 dlm_change_lockres_owner(dlm, res, new_master);
2139 res->state &= ~DLM_LOCK_RES_RECOVERING;
2140 if (__dlm_lockres_has_locks(res))
2141 __dlm_dirty_lockres(dlm, res);
2142 spin_unlock(&res->spinlock);
2143 wake_up(&res->wq);
2151 } 2144 }
2152 } 2145 }
2153} 2146}