[Ocfs2-commits] mfasheh commits r2483 - trunk/fs/ocfs2/dlm
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Fri Jul 29 16:10:10 CDT 2005
Author: mfasheh
Signed-off-by: zab
Date: 2005-07-29 16:10:08 -0500 (Fri, 29 Jul 2005)
New Revision: 2483
Modified:
trunk/fs/ocfs2/dlm/dlmcommon.h
trunk/fs/ocfs2/dlm/dlmdebug.c
trunk/fs/ocfs2/dlm/dlmdebug.h
trunk/fs/ocfs2/dlm/dlmdomain.c
trunk/fs/ocfs2/dlm/dlmmaster.c
trunk/fs/ocfs2/dlm/dlmrecovery.c
trunk/fs/ocfs2/dlm/dlmthread.c
trunk/fs/ocfs2/dlm/dlmunlock.c
Log:
* filter out some unlock actions if we get DLM_CANCELGRANT from a remote
master.
* some paths were missing calls to dlm_calc_usage, fix this
* dlm_calc_usage was sometimes dequeuing locks which should have been
purged. Make the logic there more clear.
* add a some purge list info to our lockres debug dumps
* /proc/dlm-debug is a poor location and wasn't being cleaned up on rmmod
/either. Fix both of these issues. The new location is
/proc/fs/ocfs2_dlm/debug
Signed-off-by: zab
Modified: trunk/fs/ocfs2/dlm/dlmcommon.h
===================================================================
--- trunk/fs/ocfs2/dlm/dlmcommon.h 2005-07-28 21:23:00 UTC (rev 2482)
+++ trunk/fs/ocfs2/dlm/dlmcommon.h 2005-07-29 21:10:08 UTC (rev 2483)
@@ -890,6 +890,8 @@
struct dlm_ctxt *dlm_grab(struct dlm_ctxt *dlm);
int dlm_domain_fully_joined(struct dlm_ctxt *dlm);
+void __dlm_lockres_calc_usage(struct dlm_ctxt *dlm,
+ struct dlm_lock_resource *res);
void dlm_lockres_calc_usage(struct dlm_ctxt *dlm,
struct dlm_lock_resource *res);
void dlm_purge_lockres(struct dlm_ctxt *dlm,
Modified: trunk/fs/ocfs2/dlm/dlmdebug.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmdebug.c 2005-07-28 21:23:00 UTC (rev 2482)
+++ trunk/fs/ocfs2/dlm/dlmdebug.c 2005-07-29 21:10:08 UTC (rev 2483)
@@ -112,10 +112,30 @@
.write = write_dlm_debug,
};
-void dlm_create_dlm_debug_proc_entry(void)
+#define OCFS2_DLM_PROC_PATH "fs/ocfs2_dlm"
+#define DLM_DEBUG_PROC_NAME "debug"
+static struct proc_dir_entry *ocfs2_dlm_proc;
+
+void dlm_remove_proc(void)
{
+ if (ocfs2_dlm_proc) {
+ remove_proc_entry(DLM_DEBUG_PROC_NAME, ocfs2_dlm_proc);
+ remove_proc_entry(OCFS2_DLM_PROC_PATH, NULL);
+ }
+}
+
+void dlm_init_proc(void)
+{
struct proc_dir_entry *entry;
- entry = create_proc_entry("dlm-debug", S_IWUSR, NULL);
+
+ ocfs2_dlm_proc = proc_mkdir(OCFS2_DLM_PROC_PATH, NULL);
+ if (!ocfs2_dlm_proc) {
+ mlog_errno(-ENOMEM);
+ return;
+ }
+
+ entry = create_proc_entry(DLM_DEBUG_PROC_NAME, S_IWUSR,
+ ocfs2_dlm_proc);
if (entry)
entry->proc_fops = &dlm_debug_operations;
}
@@ -216,6 +236,8 @@
mlog(ML_NOTICE, "lockres: %.*s, owner=%u, state=%u\n",
res->lockname.len, res->lockname.name,
res->owner, res->state);
+ mlog(ML_NOTICE, " last used: %lu, on purge list: %s\n",
+ res->last_used, list_empty(&res->purge) ? "no" : "yes");
mlog(ML_NOTICE, " granted queue: \n");
list_for_each(iter2, &res->granted) {
lock = list_entry(iter2, struct dlm_lock, list);
@@ -545,3 +567,4 @@
return dlm_errnames[err];
}
EXPORT_SYMBOL_GPL(dlm_errname);
+
Modified: trunk/fs/ocfs2/dlm/dlmdebug.h
===================================================================
--- trunk/fs/ocfs2/dlm/dlmdebug.h 2005-07-28 21:23:00 UTC (rev 2482)
+++ trunk/fs/ocfs2/dlm/dlmdebug.h 2005-07-29 21:10:08 UTC (rev 2483)
@@ -25,7 +25,8 @@
#ifndef DLMDEBUG_H
#define DLMDEBUG_H
-void dlm_create_dlm_debug_proc_entry(void);
+void dlm_remove_proc(void);
+void dlm_init_proc(void);
void dlm_dump_lock_resources(struct dlm_ctxt *dlm);
#endif
Modified: trunk/fs/ocfs2/dlm/dlmdomain.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmdomain.c 2005-07-28 21:23:00 UTC (rev 2482)
+++ trunk/fs/ocfs2/dlm/dlmdomain.c 2005-07-29 21:10:08 UTC (rev 2483)
@@ -1461,16 +1461,17 @@
return -1;
}
- dlm_create_dlm_debug_proc_entry();
+ dlm_init_proc();
return 0;
}
static void __exit dlm_exit (void)
{
+ dlm_remove_proc();
dlm_unregister_net_handlers();
dlm_destroy_mle_cache();
-} /* dlm_driver_exit */
+}
MODULE_AUTHOR("Oracle");
MODULE_LICENSE("GPL");
Modified: trunk/fs/ocfs2/dlm/dlmmaster.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmmaster.c 2005-07-28 21:23:00 UTC (rev 2482)
+++ trunk/fs/ocfs2/dlm/dlmmaster.c 2005-07-29 21:10:08 UTC (rev 2483)
@@ -1714,9 +1714,9 @@
}
mle = (struct dlm_master_list_entry *) kmem_cache_alloc(dlm_mle_cache,
- GFP_KERNEL);
+ GFP_KERNEL);
if (!mle) {
- ret = -ENOMEM;
+ mlog_errno(ret);
goto leave;
}
ret = 0;
@@ -1862,6 +1862,8 @@
dlm_put_mle(mle);
ret = 0;
+ dlm_lockres_calc_usage(dlm, res);
+
leave:
/* re-dirty the lockres if we failed */
if (ret < 0)
Modified: trunk/fs/ocfs2/dlm/dlmrecovery.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmrecovery.c 2005-07-28 21:23:00 UTC (rev 2482)
+++ trunk/fs/ocfs2/dlm/dlmrecovery.c 2005-07-29 21:10:08 UTC (rev 2483)
@@ -1687,8 +1687,10 @@
spin_lock(&res->spinlock);
if (res->owner == dead_node)
dlm_move_lockres_to_recovery_list(dlm, res);
- else if (res->owner == dlm->node_num)
+ else if (res->owner == dlm->node_num) {
dlm_free_dead_locks(dlm, res, dead_node);
+ __dlm_lockres_calc_usage(dlm, res);
+ }
spin_unlock(&res->spinlock);
}
}
Modified: trunk/fs/ocfs2/dlm/dlmthread.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmthread.c 2005-07-28 21:23:00 UTC (rev 2482)
+++ trunk/fs/ocfs2/dlm/dlmthread.c 2005-07-29 21:10:08 UTC (rev 2483)
@@ -114,21 +114,23 @@
/* Call whenever you may have added or deleted something from one of
* the lockres queue's. This will figure out whether it belongs on the
* unused list or not and does the appropriate thing. */
-static void __dlm_lockres_calc_usage(struct dlm_ctxt *dlm,
- struct dlm_lock_resource *res)
+void __dlm_lockres_calc_usage(struct dlm_ctxt *dlm,
+ struct dlm_lock_resource *res)
{
mlog_entry("%.*s\n", res->lockname.len, res->lockname.name);
assert_spin_locked(&dlm->spinlock);
assert_spin_locked(&res->spinlock);
- if (__dlm_lockres_unused(res) && list_empty(&res->purge)) {
- mlog(0, "putting lockres %.*s from purge list\n",
- res->lockname.len, res->lockname.name);
+ if (__dlm_lockres_unused(res)){
+ if (list_empty(&res->purge)) {
+ mlog(0, "putting lockres %.*s from purge list\n",
+ res->lockname.len, res->lockname.name);
- res->last_used = jiffies;
- list_add_tail(&res->purge, &dlm->purge_list);
- dlm->purge_count++;
+ res->last_used = jiffies;
+ list_add_tail(&res->purge, &dlm->purge_list);
+ dlm->purge_count++;
+ }
} else if (!list_empty(&res->purge)) {
mlog(0, "removing lockres %.*s from purge list\n",
res->lockname.len, res->lockname.name);
Modified: trunk/fs/ocfs2/dlm/dlmunlock.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmunlock.c 2005-07-28 21:23:00 UTC (rev 2482)
+++ trunk/fs/ocfs2/dlm/dlmunlock.c 2005-07-29 21:10:08 UTC (rev 2483)
@@ -181,6 +181,14 @@
flags, owner);
spin_lock(&res->spinlock);
spin_lock(&lock->spinlock);
+ /* if the master told us the lock was already granted,
+ * let the ast handle all of these actions */
+ if (status == DLM_NORMAL &&
+ lksb->status == DLM_CANCELGRANT) {
+ actions &= ~(DLM_UNLOCK_REMOVE_LOCK|
+ DLM_UNLOCK_REGRANT_LOCK|
+ DLM_UNLOCK_CLEAR_CONVERT_TYPE);
+ }
if (flags & LKM_CANCEL)
lock->cancel_pending = 0;
else
@@ -468,6 +476,7 @@
if (flags & LKM_PUT_LVB)
lksb->flags &= ~DLM_LKSB_PUT_LVB;
+ dlm_lockres_calc_usage(dlm, res);
dlm_kick_thread(dlm, res);
not_found:
More information about the Ocfs2-commits
mailing list