[Ocfs2-commits] smushran commits r2875 - branches/ocfs2-1.2/fs/ocfs2/dlm
svn-commits@oss.oracle.com
svn-commits at oss.oracle.com
Wed Apr 19 18:35:42 CDT 2006
Author: smushran
Signed-off-by: mfasheh
Signed-off-by: khackel
Date: 2006-04-19 18:35:41 -0500 (Wed, 19 Apr 2006)
New Revision: 2875
Modified:
branches/ocfs2-1.2/fs/ocfs2/dlm/dlmcommon.h
branches/ocfs2-1.2/fs/ocfs2/dlm/dlmrecovery.c
branches/ocfs2-1.2/fs/ocfs2/dlm/dlmthread.c
Log:
DLM: Hold ref on lockres while on recovery list
Signed-off-by: mfasheh
Signed-off-by: khackel
Modified: branches/ocfs2-1.2/fs/ocfs2/dlm/dlmcommon.h
===================================================================
--- branches/ocfs2-1.2/fs/ocfs2/dlm/dlmcommon.h 2006-04-19 23:19:27 UTC (rev 2874)
+++ branches/ocfs2-1.2/fs/ocfs2/dlm/dlmcommon.h 2006-04-19 23:35:41 UTC (rev 2875)
@@ -858,6 +858,7 @@
int dlm_dump_all_mles(const char __user *data, unsigned int len);
+int __dlm_lockres_unused(struct dlm_lock_resource *res);
static inline const char * dlm_lock_mode_name(int mode)
Modified: branches/ocfs2-1.2/fs/ocfs2/dlm/dlmrecovery.c
===================================================================
--- branches/ocfs2-1.2/fs/ocfs2/dlm/dlmrecovery.c 2006-04-19 23:19:27 UTC (rev 2874)
+++ branches/ocfs2-1.2/fs/ocfs2/dlm/dlmrecovery.c 2006-04-19 23:35:41 UTC (rev 2875)
@@ -1757,8 +1757,14 @@
struct dlm_lock *lock;
res->state |= DLM_LOCK_RES_RECOVERING;
- if (!list_empty(&res->recovering))
+ if (!list_empty(&res->recovering)) {
+ mlog(0,
+ "Recovering res %s:%.*s, is already on recovery list!\n",
+ dlm->name, res->lockname.len, res->lockname.name);
list_del_init(&res->recovering);
+ }
+ /* We need to hold a reference while on the recovery list */
+ dlm_lockres_get(res);
list_add_tail(&res->recovering, &dlm->reco.resources);
/* find any pending locks and put them back on proper list */
@@ -1847,9 +1853,11 @@
spin_lock(&res->spinlock);
dlm_change_lockres_owner(dlm, res, new_master);
res->state &= ~DLM_LOCK_RES_RECOVERING;
- __dlm_dirty_lockres(dlm, res);
+ if (!__dlm_lockres_unused(res))
+ __dlm_dirty_lockres(dlm, res);
spin_unlock(&res->spinlock);
wake_up(&res->wq);
+ dlm_lockres_put(res);
}
}
@@ -1882,11 +1890,13 @@
dlm->name, res->lockname.len,
res->lockname.name, res->owner);
list_del_init(&res->recovering);
+ dlm_lockres_put(res);
}
spin_lock(&res->spinlock);
dlm_change_lockres_owner(dlm, res, new_master);
res->state &= ~DLM_LOCK_RES_RECOVERING;
- __dlm_dirty_lockres(dlm, res);
+ if (!__dlm_lockres_unused(res))
+ __dlm_dirty_lockres(dlm, res);
spin_unlock(&res->spinlock);
wake_up(&res->wq);
}
Modified: branches/ocfs2-1.2/fs/ocfs2/dlm/dlmthread.c
===================================================================
--- branches/ocfs2-1.2/fs/ocfs2/dlm/dlmthread.c 2006-04-19 23:19:27 UTC (rev 2874)
+++ branches/ocfs2-1.2/fs/ocfs2/dlm/dlmthread.c 2006-04-19 23:35:41 UTC (rev 2875)
@@ -82,7 +82,7 @@
}
-static int __dlm_lockres_unused(struct dlm_lock_resource *res)
+int __dlm_lockres_unused(struct dlm_lock_resource *res)
{
if (list_empty(&res->granted) &&
list_empty(&res->converting) &&
More information about the Ocfs2-commits
mailing list