Whamcloud - gitweb
Add extra assertions from bug 1648 to b_devel. They have been running fine
authoradilger <adilger>
Fri, 15 Aug 2003 20:03:30 +0000 (20:03 +0000)
committeradilger <adilger>
Fri, 15 Aug 2003 20:03:30 +0000 (20:03 +0000)
on ALC and my system for a week, and will tell us if we do bad things with
the journal (i.e. forget to commit or imbalanced start/commit).

lustre/obdclass/fsfilt_ext3.c

index 55f14d4..c10d9cb 100644 (file)
@@ -71,6 +71,8 @@ static void *fsfilt_ext3_start(struct inode *inode, int op, void *desc_private)
         int nblocks = EXT3_DATA_TRANS_BLOCKS;
         void *handle;
 
+        LASSERT(current->journal_info == NULL);
+
         switch(op) {
         case FSFILT_OP_CREATE_LOG:
                 nblocks += EXT3_INDEX_EXTRA_TRANS_BLOCKS+EXT3_DATA_TRANS_BLOCKS;
@@ -118,6 +120,8 @@ static void *fsfilt_ext3_start(struct inode *inode, int op, void *desc_private)
         handle = journal_start(EXT3_JOURNAL(inode), nblocks);
         unlock_kernel();
 
+        if (!IS_ERR(handle))
+                LASSERT(current->journal_info == handle);
         return handle;
 }
 
@@ -233,11 +237,13 @@ static void *fsfilt_ext3_brw_start(int objcount, struct fsfilt_objinfo *fso,
         lock_kernel();
         handle = journal_start(journal, needed);
         unlock_kernel();
-        if (IS_ERR(handle))
+        if (IS_ERR(handle)) {
                 CERROR("can't get handle for %d credits: rc = %ld\n", needed,
                        PTR_ERR(handle));
-        else
+        } else {
                 LASSERT(handle->h_buffer_credits >= needed);
+                LASSERT(current->journal_info == handle);
+        }
 
         RETURN(handle);
 }
@@ -247,6 +253,7 @@ static int fsfilt_ext3_commit(struct inode *inode, void *h, int force_sync)
         int rc;
         handle_t *handle = h;
 
+        LASSERT(current->journal_info == handle);
         if (force_sync)
                 handle->h_sync = 1; /* recovery likes this */
 
@@ -254,6 +261,7 @@ static int fsfilt_ext3_commit(struct inode *inode, void *h, int force_sync)
         rc = journal_stop(handle);
         unlock_kernel();
 
+        LASSERT(current->journal_info == NULL);
         return rc;
 }