[Ocfs2-commits] mfasheh commits r2327 - trunk/fs/ocfs2
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Thu May 26 16:03:14 CDT 2005
Author: mfasheh
Signed-off-by: jlbec
Date: 2005-05-26 16:03:13 -0500 (Thu, 26 May 2005)
New Revision: 2327
Modified:
trunk/fs/ocfs2/dlmglue.c
trunk/fs/ocfs2/ocfs.h
trunk/fs/ocfs2/super.c
Log:
* Fix some lifetiming issues. This closes out bugzilla #456
Signed-off-by: jlbec
Modified: trunk/fs/ocfs2/dlmglue.c
===================================================================
--- trunk/fs/ocfs2/dlmglue.c 2005-05-25 23:53:04 UTC (rev 2326)
+++ trunk/fs/ocfs2/dlmglue.c 2005-05-26 21:03:13 UTC (rev 2327)
@@ -155,9 +155,6 @@
return (struct inode *) lockres->l_priv;
}
-static void ocfs2_lock_res_init_common(ocfs2_lock_res *res,
- enum ocfs2_lock_type type,
- void *priv);
static int ocfs2_lock_create(ocfs_super *osb,
ocfs2_lock_res *lockres,
int level,
@@ -287,7 +284,7 @@
mlog_entry_void();
- OCFS_ASSERT(type < OCFS_NUM_LOCK_TYPES);
+ BUG_ON(type >= OCFS_NUM_LOCK_TYPES);
name = kmalloc(OCFS2_LOCK_ID_MAX_LEN, GFP_KERNEL);
if (!name) {
@@ -300,7 +297,7 @@
ocfs2_lock_type_char[type], OCFS2_LOCK_ID_PAD, blkno,
generation);
- OCFS_ASSERT(len == (OCFS2_LOCK_ID_MAX_LEN - 1));
+ BUG_ON(len != (OCFS2_LOCK_ID_MAX_LEN - 1));
mlog(0, "built lock resource with name: %s\n", name);
@@ -312,41 +309,44 @@
static void ocfs2_lock_res_init_common(ocfs2_lock_res *res,
enum ocfs2_lock_type type,
+ struct ocfs2_lock_res_ops *ops,
void *priv)
{
+ res->l_type = type;
+ res->l_ops = ops;
+ res->l_priv = priv;
+
+ res->l_level = LKM_IVMODE;
+ res->l_requested = LKM_IVMODE;
+ res->l_blocking = LKM_IVMODE;
+ res->l_action = OCFS2_AST_INVALID;
+ res->l_unlock_action = OCFS2_UNLOCK_INVALID;
+
+ res->l_flags = OCFS2_LOCK_INITIALIZED;
+}
+
+void ocfs2_lock_res_init_once(ocfs2_lock_res *res)
+{
+ /* This also clears out the lock status block */
memset(res, 0, sizeof(ocfs2_lock_res));
spin_lock_init(&res->l_lock);
init_waitqueue_head(&res->l_event);
- res->l_type = type;
- res->l_level = LKM_IVMODE;
INIT_LIST_HEAD(&res->l_blocked_list);
INIT_LIST_HEAD(&res->l_flag_cb_list);
- res->l_priv = priv;
}
-void ocfs2_lock_res_init_once(ocfs2_lock_res *res)
-{
- res->l_name = NULL;
-}
-
int ocfs2_inode_lock_res_init(ocfs2_lock_res *res,
enum ocfs2_lock_type type,
struct inode *inode)
{
int status;
+ struct ocfs2_lock_res_ops *ops;
mlog_entry_void();
OCFS_ASSERT(type == OCFS_TYPE_META ||
type == OCFS_TYPE_DATA);
- ocfs2_lock_res_init_common(res, type, inode);
-
- if (type == OCFS_TYPE_META)
- res->l_ops = &ocfs2_inode_meta_lops;
- else
- res->l_ops = &ocfs2_inode_data_lops;
-
status = ocfs2_build_lock_name(type,
OCFS2_I(inode)->ip_blkno,
inode->i_generation,
@@ -356,6 +356,13 @@
goto bail;
}
+ if (type == OCFS_TYPE_META)
+ ops = &ocfs2_inode_meta_lops;
+ else
+ ops = &ocfs2_inode_data_lops;
+
+ ocfs2_lock_res_init_common(res, type, ops, inode);
+
bail:
mlog_exit(status);
return status;
@@ -369,10 +376,10 @@
mlog_entry_void();
- ocfs2_lock_res_init_common(res, type, osb);
+ /* Superblock lockres doesn't come from a slab so we call init
+ * once on it manually. */
+ ocfs2_lock_res_init_once(res);
- res->l_ops = &ocfs2_super_lops;
-
status = ocfs2_build_lock_name(type,
OCFS2_SUPER_BLOCK_BLKNO,
0,
@@ -382,6 +389,8 @@
goto bail;
}
+ ocfs2_lock_res_init_common(res, type, &ocfs2_super_lops, osb);
+
bail:
mlog_exit(status);
return status;
@@ -391,11 +400,34 @@
{
mlog_entry_void();
- if (res->l_name)
- kfree(res->l_name);
+ if (!(res->l_flags & OCFS2_LOCK_INITIALIZED))
+ return;
- ocfs2_lock_res_init_once(res);
+ mlog_bug_on_msg(!res->l_name,
+ "Lockres initialized without name!\n");
+ mlog_bug_on_msg(!list_empty(&res->l_blocked_list),
+ "Lockres %s is on the blocked list\n",
+ res->l_name);
+ mlog_bug_on_msg(!list_empty(&res->l_flag_cb_list),
+ "Lockres %s has flag callbacks pending\n",
+ res->l_name);
+ mlog_bug_on_msg(spin_is_locked(&res->l_lock),
+ "Lockres %s is locked\n",
+ res->l_name);
+ mlog_bug_on_msg(res->l_ro_holders,
+ "Lockres %s has %u ro holders\n",
+ res->l_name, res->l_ro_holders);
+ mlog_bug_on_msg(res->l_ex_holders,
+ "Lockres %s has %u ro holders\n",
+ res->l_name, res->l_ex_holders);
+ kfree(res->l_name);
+ res->l_name = NULL;
+ res->l_local_seq = 0;
+ /* Need to clear out the lock status block for the dlm */
+ memset(&res->l_lksb, 0, sizeof(res->l_lksb));
+
+ res->l_flags = 0UL;
mlog_exit_void();
}
@@ -1092,6 +1124,8 @@
mlog_entry_void();
+ mlog(0, "Inode %llu\n", OCFS2_I(inode)->ip_blkno);
+
/* NOTE: That we don't increment any of the holder counts, nor
* do we add anything to a journal handle. Since this is
* supposed to be a new inode which the cluster doesn't know
@@ -1844,6 +1878,10 @@
ocfs2_lock_res *lockres,
struct drop_lock_cb *dcb)
{
+ /* We didn't get anywhere near actually using this lockres. */
+ if (!(lockres->l_flags & OCFS2_LOCK_INITIALIZED))
+ return 0;
+
spin_lock(&lockres->l_lock);
while (lockres->l_flags & OCFS2_LOCK_BUSY) {
Modified: trunk/fs/ocfs2/ocfs.h
===================================================================
--- trunk/fs/ocfs2/ocfs.h 2005-05-25 23:53:04 UTC (rev 2326)
+++ trunk/fs/ocfs2/ocfs.h 2005-05-26 21:03:13 UTC (rev 2327)
@@ -148,6 +148,8 @@
#define OCFS2_LOCK_LOCAL (0x00000008) /* newly created inode */
#define OCFS2_LOCK_NEEDS_REFRESH (0x00000010)
#define OCFS2_LOCK_REFRESHING (0x00000020)
+#define OCFS2_LOCK_INITIALIZED (0x00000040) /* track initialization
+ * for shutdown paths */
struct ocfs2_lock_res_ops;
Modified: trunk/fs/ocfs2/super.c
===================================================================
--- trunk/fs/ocfs2/super.c 2005-05-25 23:53:04 UTC (rev 2326)
+++ trunk/fs/ocfs2/super.c 2005-05-26 21:03:13 UTC (rev 2327)
@@ -652,7 +652,7 @@
oi->ip_mmu_private = 0LL;
ocfs2_lock_res_init_once(&oi->ip_meta_lockres);
- ocfs2_lock_res_init_once(&oi->ip_meta_lockres);
+ ocfs2_lock_res_init_once(&oi->ip_data_lockres);
inode_init_once(&oi->vfs_inode);
}
@@ -1010,6 +1010,8 @@
if (osb->slot_num != OCFS2_INVALID_SLOT)
ocfs2_put_slot(osb);
+
+ ocfs2_super_unlock(osb, 1);
}
ocfs_release_system_inodes(osb);
More information about the Ocfs2-commits
mailing list