Whamcloud - gitweb
add per-thread debugging flags. Use then to control CDEBUG().
authornikita <nikita>
Tue, 21 Nov 2006 14:24:40 +0000 (14:24 +0000)
committernikita <nikita>
Tue, 21 Nov 2006 14:24:40 +0000 (14:24 +0000)
lustre/kernel_patches/patches/debugging-fields-in-current.patch [new file with mode: 0644]
lustre/kernel_patches/patches/ext3-iam-separate.patch
lustre/kernel_patches/series/2.6-rhel4.series
lustre/mdd/mdd_dir.c
lustre/mdt/mdt_reint.c

diff --git a/lustre/kernel_patches/patches/debugging-fields-in-current.patch b/lustre/kernel_patches/patches/debugging-fields-in-current.patch
new file mode 100644 (file)
index 0000000..5bbba37
--- /dev/null
@@ -0,0 +1,14 @@
+Index: linux/include/linux/sched.h
+===================================================================
+--- linux.orig/include/linux/sched.h
++++ linux/include/linux/sched.h
+@@ -650,6 +650,9 @@ struct task_struct {
+ #endif
+       /* where this task blocked */
+       struct sleep_info sinfo;
++
++      __u64 debugging0;
++      __u64 debugging1;
+ };
+ static inline pid_t process_group(struct task_struct *tsk)
index 5934e16..82a847b 100644 (file)
@@ -2887,7 +2887,7 @@ Index: iam/fs/ext3/iam_lvar.c
 ===================================================================
 --- iam.orig/fs/ext3/iam_lvar.c
 +++ iam/fs/ext3/iam_lvar.c
-@@ -0,0 +1,1048 @@
+@@ -0,0 +1,1045 @@
 +/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
 + * vim:expandtab:shiftwidth=8:tabstop=8:
 + *
@@ -3295,9 +3295,6 @@ Index: iam/fs/ext3/iam_lvar.c
 +        l->il_at = lvar_lentry(e_next(l, n_cur(l)));
 +}
 +
-+atomic_t lvar_enoent_debug = ATOMIC_INIT(0);
-+EXPORT_SYMBOL(lvar_enoent_debug);
-+
 +static int lvar_lookup(struct iam_leaf *leaf, const struct iam_key *k)
 +{
 +        struct lvar_leaf_entry *found;
@@ -3360,7 +3357,7 @@ Index: iam/fs/ext3/iam_lvar.c
 +                result |= IAM_LOOKUP_LAST;
 +        assert_inv(n_invariant(leaf));
 +
-+        if (unlikely(atomic_read(&lvar_enoent_debug))) {
++        if (unlikely(current->debugging1 & 0x1)) {
 +                struct iam_path *path;
 +
 +                path = leaf->il_path;
index cdd7279..5050509 100644 (file)
@@ -36,3 +36,4 @@ jbd-copy-out-everything.patch
 jbd-checkpoint-on-commit.patch 
 export-nr_free_buffer_pages.patch 
 __find_get_block_slow-scale.patch 
+debugging-fields-in-current.patch 
index 92d115f..aef052a 100644 (file)
@@ -538,7 +538,6 @@ int mdd_unlink_sanity_check(const struct lu_env *env, struct mdd_object *pobj,
         RETURN(rc);
 }
 
-extern atomic_t lvar_enoent_debug;
 static int mdd_unlink(const struct lu_env *env, struct md_object *pobj,
                       struct md_object *cobj, const char *name,
                       struct md_attr *ma)
@@ -583,13 +582,12 @@ static int mdd_unlink(const struct lu_env *env, struct md_object *pobj,
                 GOTO(cleanup, rc);
 
         is_dir = S_ISDIR(lu_object_attr(&cobj->mo_lu));
-        /*
-         * This should be per-thread debugging flag, but
-         */
-        atomic_inc(&lvar_enoent_debug);
+
+        current->debugging1 |= 0x1; /* XXX enable lvar_enoent_debug
+                                     * debugging */
         rc = __mdd_index_delete(env, mdd_pobj, name, is_dir, handle,
                                 mdd_object_capa(env, mdd_pobj));
-        atomic_dec(&lvar_enoent_debug);
+        current->debugging1 &= ~0x1;
         if (rc)
                 GOTO(cleanup, rc);
 
index e7c4cf5..f35d2b8 100644 (file)
@@ -74,13 +74,13 @@ static int mdt_md_create(struct mdt_thread_info *info)
                 /* Let lower layer know current lock mode. */
                 info->mti_spec.sp_cr_mode =
                         mdt_dlm_mode2mdl_mode(lh->mlh_pdo_mode);
-                
-                /* 
+
+                /*
                  * Do perform lookup sanity check. We do not know if name exists
                  * or not.
                  */
                 info->mti_spec.sp_cr_lookup = 1;
-                
+
                 rc = mdo_create(info->mti_env, next, rr->rr_name,
                                 mdt_object_child(child),
                                 &info->mti_spec, ma);
@@ -118,7 +118,7 @@ static int mdt_md_mkobj(struct mdt_thread_info *info)
 
                 ma->ma_need = MA_INODE;
                 ma->ma_valid = 0;
-                
+
                 /*
                  * Cross-ref create can encounter already created obj in case of
                  * recovery, just get attr in that case.
@@ -225,7 +225,7 @@ static int mdt_reint_setattr(struct mdt_thread_info *info,
 
         mdt_lprocfs_time_start(info->mti_mdt, &info->mti_time,
                                LPROC_MDT_REINT_SETATTR);
-        
+
         DEBUG_REQ(D_INODE, req, "setattr "DFID" %x", PFID(rr->rr_fid1),
                   (unsigned int)ma->ma_attr.la_valid);
 
@@ -327,7 +327,7 @@ static int mdt_reint_create(struct mdt_thread_info *info,
 
         mdt_lprocfs_time_start(info->mti_mdt, &info->mti_time,
                                LPROC_MDT_REINT_CREATE);
-        
+
         if (MDT_FAIL_CHECK(OBD_FAIL_MDS_REINT_CREATE))
                 GOTO(out, rc = err_serious(-ESTALE));
 
@@ -376,7 +376,13 @@ static int mdt_reint_unlink(struct mdt_thread_info *info,
 
         mdt_lprocfs_time_start(info->mti_mdt, &info->mti_time,
                                LPROC_MDT_REINT_UNLINK);
-        
+
+        /*
+         * XXX Enforce full debugging log for unlinks, to track buffalo
+         * -ENOENT error.
+         */
+        current->debugging0 = ~0;
+
         DEBUG_REQ(D_INODE, req, "unlink "DFID"/%s\n", PFID(rr->rr_fid1),
                   rr->rr_name);
 
@@ -466,6 +472,7 @@ out:
         mdt_shrink_reply(info, REPLY_REC_OFF + 1, 0, 0);
         mdt_lprocfs_time_end(info->mti_mdt, &info->mti_time,
                              LPROC_MDT_REINT_UNLINK);
+        current->debugging0 = 0;
         return rc;
 }
 
@@ -484,7 +491,7 @@ static int mdt_reint_link(struct mdt_thread_info *info,
 
         mdt_lprocfs_time_start(info->mti_mdt, &info->mti_time,
                                LPROC_MDT_REINT_LINK);
-        
+
         DEBUG_REQ(D_INODE, req, "link "DFID" to "DFID"/%s",
                   PFID(rr->rr_fid1), PFID(rr->rr_fid2), rr->rr_name);
 
@@ -512,7 +519,7 @@ static int mdt_reint_link(struct mdt_thread_info *info,
          * processing it */
         if (lu_fid_eq(rr->rr_fid1, rr->rr_fid2))
                 GOTO(out, rc = -EPERM);
-        
+
         /* step 1: find & lock the target parent dir */
         lhp = &info->mti_lh[MDT_LH_PARENT];
         mdt_lock_pdo_init(lhp, LCK_EX, rr->rr_name,
@@ -525,11 +532,11 @@ static int mdt_reint_link(struct mdt_thread_info *info,
         /* step 2: find & lock the source */
         lhs = &info->mti_lh[MDT_LH_CHILD];
         mdt_lock_reg_init(lhs, LCK_EX);
+
         ms = mdt_object_find(info->mti_env, info->mti_mdt, rr->rr_fid1);
         if (IS_ERR(ms))
                 GOTO(out_unlock_parent, rc = PTR_ERR(ms));
-        
+
         rc = mdt_object_lock(info, ms, lhs, MDS_INODELOCK_UPDATE,
                             MDT_CROSS_LOCK);
         if (rc != 0) {
@@ -734,7 +741,7 @@ static int mdt_reint_rename(struct mdt_thread_info *info,
 
         mdt_lprocfs_time_start(info->mti_mdt, &info->mti_time,
                                LPROC_MDT_REINT_RENAME);
-        
+
         if (info->mti_cross_ref) {
                 rc = mdt_reint_rename_tgt(info);
                 mdt_lprocfs_time_end(info->mti_mdt, &info->mti_time,