Whamcloud - gitweb
(1) make MDT replayable to eliminate mdc_close() crash on client;
authorhuanghua <huanghua>
Wed, 26 Jul 2006 15:08:27 +0000 (15:08 +0000)
committerhuanghua <huanghua>
Wed, 26 Jul 2006 15:08:27 +0000 (15:08 +0000)
(2) some some debugging code for ll_file_open()/ll_file_release();
(3) add some deugging code for transaction related functions.

lustre/llite/dcache.c
lustre/llite/file.c
lustre/mdt/mdt_handler.c
lustre/ptlrpc/client.c

index c51edd7..d7f039a 100644 (file)
@@ -132,6 +132,7 @@ void ll_intent_release(struct lookup_intent *it)
 {
         ENTRY;
 
+        CDEBUG(D_INFO, "intent %p released\n", it);
         ll_intent_drop_lock(it);
         it->it_magic = 0;
         it->it_op_release = 0;
@@ -267,8 +268,9 @@ void ll_frob_intent(struct lookup_intent **itp, struct lookup_intent *deft)
         struct lookup_intent *it = *itp;
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
         if (it) {
-                LASSERTF(it->it_magic == INTENT_MAGIC, "bad intent magic: %x\n",
-                         it->it_magic);
+                LASSERTF(it->it_magic == INTENT_MAGIC, 
+                         "%p has bad intent magic: %x\n",
+                         it, it->it_magic);
         }
 #endif
 
index ee388a1..34f4c58 100644 (file)
@@ -98,6 +98,15 @@ static int ll_close_inode_openhandle(struct obd_export *md_exp,
         RETURN(rc);
 }
 
+/* just for debugging by huanghua@clusterfs.com, will be removed later */
+#include <lustre_lib.h>
+struct mdc_open_data {
+        struct obd_client_handle *mod_och;
+        struct ptlrpc_request    *mod_open_req;
+        struct ptlrpc_request    *mod_close_req;
+};
+/* --end: just for debugging by huanghua@clusterfs.com*/
+
 int ll_md_close(struct obd_export *md_exp, struct inode *inode,
                 struct file *file)
 {
@@ -113,6 +122,12 @@ int ll_md_close(struct obd_export *md_exp, struct inode *inode,
                 rc = ll_extent_unlock(fd, inode, lsm, LCK_GROUP,
                                       &fd->fd_cwlockh);
         }
+        CDEBUG(D_INFO, "closing ino = %lu file = %p has open req = %p:%x"
+                       " handle="LPX64"\n",
+                       inode->i_ino, file,
+                       och->och_mod->mod_open_req,
+                       och->och_mod->mod_open_req->rq_type,
+                       och->och_fh.cookie);
         
         rc = ll_close_inode_openhandle(md_exp, inode, och);
         och->och_fh.cookie = DEAD_HANDLE_MAGIC;
@@ -300,7 +315,12 @@ int ll_file_open(struct inode *inode, struct file *file)
         }
 
         rc = ll_local_open(file, it, fd);
+        req = it->d.lustre.it_data;
         LASSERTF(rc == 0, "rc = %d\n", rc);
+        CDEBUG(D_INFO, "opening ino = %lu file = %p has open req = %p:%x"
+                       " handle="LPX64"\n",
+                       inode->i_ino, file, req, req->rq_type, 
+                       fd->fd_mds_och.och_fh.cookie);
 
         if (!S_ISREG(inode->i_mode))
                 GOTO(out, rc);
index 73cc9c3..fec0580 100644 (file)
@@ -1122,14 +1122,15 @@ int mdt_update_last_transno(struct mdt_thread_info *info, int rc)
 
         if (rc == 0) {
                 last_transno = info->mti_transno;
-                CDEBUG(D_INFO, "last_transno = %llu, last_committed = %llu\n",
-                       last_transno, last_committed);
         } else {
                 last_transno = 0;
                 CERROR("replay %s transno "LPU64" failed: rc %d\n",
                        libcfs_nid2str(exp->exp_connection->c_peer.nid),
                        info->mti_transno, rc);
         }
+        CDEBUG(D_HA, "last_transno = %llu, last_committed = %llu\n",
+               last_transno, last_committed);
+
         req->rq_repmsg->transno = req->rq_transno = last_transno;
         req->rq_repmsg->last_xid = req->rq_xid;
         req->rq_repmsg->last_committed = last_committed;
@@ -1218,8 +1219,7 @@ static int mdt_req_handle(struct mdt_thread_info *info,
         if (h->mh_opc != MDS_DISCONNECT &&
             h->mh_opc != MDS_READPAGE &&
             h->mh_opc != LDLM_ENQUEUE) {
-                /* FIXME: fake untill journal callback is OK.*/
-                mdt_update_last_transno(info, result);
+                        mdt_update_last_transno(info, result);
         }
         RETURN(result);
 }
@@ -2259,6 +2259,7 @@ static int mdt_init0(const struct lu_context *ctx, struct mdt_device *m,
         m->mdt_opts.mo_user_xattr = 0;
         m->mdt_opts.mo_acl = 0;
         m->mdt_opts.mo_compat_resname = 0;
+        obd->obd_replayable = 1;
 
 
         OBD_ALLOC_PTR(s);
index 2732e53..b82d5a8 100644 (file)
@@ -641,6 +641,11 @@ static int after_reply(struct ptlrpc_request *req)
         }
 
         /* Store transno in reqmsg for replay. */
+        CDEBUG(D_INFO, "req->replayable = %d, transno = "LPU64
+                        " committed = "LPU64"\n",
+                        req->rq_import->imp_replayable,
+                        req->rq_repmsg->transno,
+                        req->rq_repmsg->last_committed);
         req->rq_reqmsg->transno = req->rq_transno = req->rq_repmsg->transno;
 
         if (req->rq_import->imp_replayable) {