Skip to contentSkip to conversation

ocfs2/dlm: add assertion on lksb->lvb

PATCH New Wengang Wang 1 participant 1 message Aug 26, 2010 OCFS2

lore
Share & tools
lore
#0 lore raw

PATCH 3/5 ocfs2/dlm: add assertion on lksb->lvb

Add assertions on lksb->lvb before we access it.

---
 fs/ocfs2/dlm/dlmast.c      |    2 ++
 fs/ocfs2/dlm/dlmrecovery.c |    5 +++++
 2 files changed, 7 insertions(+), 0 deletions(-)
fs/ocfs2/dlm/dlmast.c +2 -0
index fe272b1..b4287c6 100644
@@ -193,6 +193,8 @@ static void dlm_update_lvb(struct dlm_ctxt *dlm, struct dlm_lock_resource *res,
 				  "remote");
 			mlog_bug_on_msg(!res->lvb, "lockname : %.*s\n",
 					res->lockname.len, res->lockname.name);
+			mlog_bug_on_msg(!lksb->lvb, "lockname : %.*s\n",
+					res->lockname.len, res->lockname.name);
 			memcpy(lksb->lvb, res->lvb, DLM_LVB_LEN);
 		}
 		/* Do nothing for lvb put requests - they should be done in
fs/ocfs2/dlm/dlmrecovery.c +5 -0
index e41780c..fa6e5ae 100644
@@ -1189,6 +1189,7 @@ static void dlm_prepare_lvb_for_migration(struct dlm_lock *lock,
 	}
 
 	/* Ensure the lvb copied for migration matches in other valid locks */
+	BUG_ON(!lock->lksb->lvb);
 	if (!memcmp(mres->lvb, lock->lksb->lvb, DLM_LVB_LEN))
 		return;
 
@@ -1884,6 +1885,10 @@ static int dlm_process_recovery_data(struct dlm_ctxt *dlm,
 			goto skip_lvb;
 
 		if (!dlm_lvb_is_empty(mres->lvb)) {
+			if (!lksb->lvb) {
+				dlm_print_one_lock_resource(res);
+				BUG();
+			}
 			if (lksb->flags & DLM_LKSB_PUT_LVB) {
 				/* other node was trying to update
 				 * lvb when node died.  recreate the
Signature · 1 line
1.7.2.1