Whamcloud - gitweb
Branch: b_new_cmd
authorwangdi <wangdi>
Sat, 5 Aug 2006 06:28:38 +0000 (06:28 +0000)
committerwangdi <wangdi>
Sat, 5 Aug 2006 06:28:38 +0000 (06:28 +0000)
1 add mti_transno_flag to check whether this req handler need transno update
  for those lnk and some special node. we do not need.
2. set DISP_OPEN_OPEN in correct place
3. do not do unlink log in mdd_unlink. since it should only unlink the
   metaobject. add the unlink log after open orphan is implemented.

lustre/mdd/mdd_handler.c
lustre/mdt/mdt_handler.c
lustre/mdt/mdt_internal.h
lustre/mdt/mdt_open.c

index 940a807..bb7fc13 100644 (file)
@@ -718,10 +718,14 @@ static int mdd_unlink(const struct lu_context *ctxt, struct md_object *pobj,
                 /* unlink dotdot */
                 __mdd_ref_del(ctxt, mdd_pobj, handle, NULL);
         }
+#if 0
+        /*This should be moved to handle last unlink. wait open 
+         * orphan prototype finished*/
         if (S_ISREG(ma->ma_attr.la_mode) && (ma->ma_valid & MA_LOV) &&
             ma->ma_attr.la_nlink == 0 && cobj->mo_lu.lo_header->loh_ref == 1) {
                 rc = mdd_unlink_log(ctxt, mdd, mdd_cobj, ma);
         }
+#endif
 cleanup:
         mdd_unlock2(ctxt, mdd_pobj, mdd_cobj);
         mdd_trans_stop(ctxt, mdd, handle);
index 2d78fce..3d907c4 100644 (file)
@@ -1080,7 +1080,9 @@ int mdt_update_last_transno(struct mdt_thread_info *info, int rc)
 
         if (mdt == NULL || req == NULL || req->rq_repmsg == NULL)
                 return -EFAULT;
-
+        if (info->mti_trans_flags & MDT_NONEED_TANSNO)
+                return 0;
+        
         last_committed = mdt->mdt_last_committed;
 
         if (rc == 0) {
index 8825ce1..8d9f91d 100644 (file)
@@ -177,6 +177,7 @@ struct mdt_reint_record {
 
 };
 
+#define MDT_NONEED_TANSNO  0x0000001 /*Do not need transno for this req*/
 
 /*
  * Common data shared by mdt-level handlers. This is allocated per-thread to
@@ -246,7 +247,8 @@ struct mdt_thread_info {
         } mti_u;
         /* transaction number of current request */
         __u64                      mti_transno;
-
+        __u32                      mti_trans_flags;
+        
         /* readdir hint structure */
         struct lu_rdpg             mti_rdpg;
 };
index dd67bf5..e61fbe1 100644 (file)
@@ -94,9 +94,9 @@ static int mdt_mfd_open(struct mdt_thread_info *info,
         struct md_attr         *ma = &info->mti_attr;
         struct lu_attr         *la = &ma->ma_attr;
         struct ptlrpc_request  *req = mdt_info_req(info);
+        struct ldlm_reply      *ldlm_rep;
         int                     rc = 0;
-        int                     isreg;
-        int                     isdir;
+        int                     isreg, isdir, islnk;
         ENTRY;
 
         med = &req->rq_export->exp_mdt_data;
@@ -110,10 +110,16 @@ static int mdt_mfd_open(struct mdt_thread_info *info,
         }
         isreg = S_ISREG(la->la_mode);
         isdir = S_ISDIR(la->la_mode);
-
+        islnk = S_ISLNK(la->la_mode);
         if (ma->ma_valid & MA_INODE)
                 mdt_pack_attr2body(repbody, la, mdt_object_fid(o));
 
+        /* if we are following a symlink, don't open */
+        if (islnk || (!isreg && !isdir &&
+            (req->rq_export->exp_connect_flags & OBD_CONNECT_NODEVOH))) {
+                info->mti_trans_flags |= MDT_NONEED_TANSNO; 
+                RETURN(0);
+        }
         /* FIXME:maybe this can be done earlier? */
         if (isdir) {
                 if (flags & (MDS_OPEN_CREAT | FMODE_WRITE)) {
@@ -157,10 +163,14 @@ static int mdt_mfd_open(struct mdt_thread_info *info,
                         repbody->valid |= OBD_MD_FLEASIZE;
         }
 
+        ldlm_rep = req_capsule_server_get(&info->mti_pill, &RMF_DLM_REP);
+        
+        intent_set_disposition(ldlm_rep, DISP_OPEN_OPEN);
         /*FIXME: should determine the offset dynamicly, 
          *did not get ACL before shrink*/
         lustre_shrink_reply(req, 2, repbody->eadatasize, 1);
-        lustre_shrink_reply(req, repbody->eadatasize ? 3 : 2, repbody->aclsize, 0);
+        lustre_shrink_reply(req, repbody->eadatasize ? 3 : 2, repbody->aclsize,
+                            0);
 
         if (flags & FMODE_WRITE) {
                 /*mds_get_write_access*/
@@ -341,7 +351,6 @@ int mdt_reint_open(struct mdt_thread_info *info)
 
         /* Open it now. */
         result = mdt_mfd_open(info, parent, child, la->la_flags, created);
-        intent_set_disposition(ldlm_rep, DISP_OPEN_OPEN);
         GOTO(finish_open, result);
 
 finish_open: