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

Signed-off-by: Wengang Wang <[email protected]>
---
 fs/ocfs2/dlm/dlmast.c      |    2 ++
 fs/ocfs2/dlm/dlmrecovery.c |    5 +++++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/fs/ocfs2/dlm/dlmast.c b/fs/ocfs2/dlm/dlmast.c
index fe272b1..b4287c6 100644
--- a/fs/ocfs2/dlm/dlmast.c
+++ b/fs/ocfs2/dlm/dlmast.c
@@ -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
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
index e41780c..fa6e5ae 100644
--- a/fs/ocfs2/dlm/dlmrecovery.c
+++ b/fs/ocfs2/dlm/dlmrecovery.c
@@ -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
-- 
1.7.2.1


_______________________________________________
Ocfs2-devel mailing list
[email protected]
http://oss.oracle.com/mailman/listinfo/ocfs2-devel

Reply via email to