Whamcloud - gitweb
- rc_swabbed is set after swabbing
authortappro <tappro>
Mon, 26 Jun 2006 10:34:49 +0000 (10:34 +0000)
committertappro <tappro>
Mon, 26 Jun 2006 10:34:49 +0000 (10:34 +0000)
- fix issue with opc in mdt_intent_reint()
- changes in mdt_reint_open() in order of making open() proto

lustre/include/lustre_req_layout.h
lustre/mdt/mdt_handler.c
lustre/mdt/mdt_reint.c
lustre/ptlrpc/layout.c

index 291a026..7ec55d5 100644 (file)
@@ -61,11 +61,11 @@ void req_capsule_fini(struct req_capsule *pill);
 void req_capsule_set(struct req_capsule *pill, const struct req_format *fmt);
 int  req_capsule_pack(struct req_capsule *pill);
 
-void *req_capsule_client_get(const struct req_capsule *pill,
+void *req_capsule_client_get(struct req_capsule *pill,
                              const struct req_msg_field *field);
-void *req_capsule_server_get(const struct req_capsule *pill,
+void *req_capsule_server_get(struct req_capsule *pill,
                              const struct req_msg_field *field);
-const void *req_capsule_other_get(const struct req_capsule *pill,
+const void *req_capsule_other_get(struct req_capsule *pill,
                                   const struct req_msg_field *field);
 
 void req_capsule_set_size(const struct req_capsule *pill,
index b475a24..eb2062f 100644 (file)
@@ -912,7 +912,7 @@ static int mdt_body_unpack(struct mdt_thread_info *info, __u32 flags)
         const struct mdt_body    *body;
         struct mdt_object        *obj;
         const struct lu_context  *ctx;
-        const struct req_capsule *pill;
+        struct req_capsule *pill;
 
         ctx = info->mti_ctxt;
         pill = &info->mti_pill;
@@ -1501,6 +1501,7 @@ static int mdt_intent_reint(enum mdt_it_code opcode,
                             int flags)
 {
         long opc;
+        int rc;
         struct ldlm_reply *rep;
 
         static const struct req_format *intent_fmts[REINT_MAX] = {
@@ -1520,9 +1521,9 @@ static int mdt_intent_reint(enum mdt_it_code opcode,
                 RETURN(-EPROTO);
         }
 
-        opc = req_capsule_pack(&info->mti_pill);
-        if (opc)
-                RETURN(opc);
+        rc = req_capsule_pack(&info->mti_pill);
+        if (rc)
+                RETURN(rc);
 
         rep = req_capsule_server_get(&info->mti_pill, &RMF_DLM_REP);
         if (rep == NULL)
index 4062f3a..86e0d81 100644 (file)
@@ -579,14 +579,15 @@ static int mdt_reint_open(struct mdt_thread_info *info)
         struct lov_mds_md      *lmm  = info->mti_reint_rep.mrr_md;
         struct mdt_reint_record *rr = &info->mti_rr;
         int                     created = 0;
-        struct lu_fid           child_fid;
+        struct lu_fid          child_fid;
         ENTRY;
 
         lh = &info->mti_lh[MDT_LH_PARENT];
         lh->mlh_mode = LCK_PW;
 
-        req_capsule_pack(&info->mti_pill);
+        //req_capsule_pack(&info->mti_pill);
         ldlm_rep = req_capsule_server_get(&info->mti_pill, &RMF_DLM_REP);
+        body = req_capsule_server_get(&info->mti_pill, &RMF_MDT_BODY);
 
         parent = mdt_object_find_lock(info->mti_ctxt, mdt, rr->rr_fid1,
                                       lh, MDS_INODELOCK_UPDATE);
@@ -601,18 +602,20 @@ static int mdt_reint_open(struct mdt_thread_info *info)
 
         intent_set_disposition(ldlm_rep, DISP_LOOKUP_EXECD);
 
-        if (result == -ENOENT)
-                intent_set_disposition(ldlm_rep, DISP_LOOKUP_NEG);
-        else
-                intent_set_disposition(ldlm_rep, DISP_LOOKUP_POS);
-
         if (result == -ENOENT) {
-                if(!(info->mti_attr.la_flags & MDS_OPEN_CREAT))
+                intent_set_disposition(ldlm_rep, DISP_LOOKUP_NEG);
+                if (!(info->mti_attr.la_flags & MDS_OPEN_CREAT))
                         GOTO(out_parent, result);
                 if (req->rq_export->exp_connect_flags & OBD_CONNECT_RDONLY)
                         GOTO(out_parent, result = -EROFS);
-        }
+                child_fid = *info->mti_rr.rr_fid2;
+        } else {
+                intent_set_disposition(ldlm_rep, DISP_LOOKUP_POS);
+                if (info->mti_attr.la_flags & MDS_OPEN_EXCL &&
+                    info->mti_attr.la_flags & MDS_OPEN_CREAT)
+                        GOTO(out_parent, result = -EEXIST);
 
+        }
         child = mdt_object_find(info->mti_ctxt, mdt, &child_fid);
         if (IS_ERR(child))
                 GOTO(out_parent, result = PTR_ERR(child));
@@ -628,17 +631,14 @@ static int mdt_reint_open(struct mdt_thread_info *info)
                 if (result != 0)
                         GOTO(out_child, result);
                 created = 1;
-        } else if (info->mti_attr.la_flags & MDS_OPEN_EXCL &&
-                   info->mti_attr.la_flags & MDS_OPEN_CREAT) {
-                        GOTO(out_child, result = -EEXIST);
+        } else {
+                result = mo_attr_get(info->mti_ctxt,
+                                     mdt_object_child(child),
+                                     &info->mti_attr);
+                if (result != 0)
+                        GOTO(destroy_child, result);
         }
 
-        result = mo_attr_get(info->mti_ctxt,
-                             mdt_object_child(child),
-                             &info->mti_attr);
-        if (result != 0)
-                GOTO(destroy_child, result);
-
         mdt_pack_attr2body(body, &info->mti_attr);
         body->fid1 = *mdt_object_fid(child);
         body->valid |= OBD_MD_FLID;
index f32655c..603c242 100644 (file)
@@ -657,7 +657,7 @@ static int __req_capsule_offset(const struct req_capsule *pill,
         return offset;
 }
 
-static void *__req_capsule_get(const struct req_capsule *pill,
+static void *__req_capsule_get(struct req_capsule *pill,
                                const struct req_msg_field *field,
                                enum req_location loc)
 {
@@ -688,8 +688,10 @@ static void *__req_capsule_get(const struct req_capsule *pill,
 
         if (!(pill->rc_swabbed & (1 << offset)) && loc != pill->rc_loc &&
             field->rmf_swabber != NULL && value != NULL &&
-            lustre_msg_swabbed(msg))
+            lustre_msg_swabbed(msg)) {
                 field->rmf_swabber(value);
+                pill->rc_swabbed |= (1 << offset);
+        }
         if (value == NULL)
                 DEBUG_REQ(D_ERROR, pill->rc_req,
                           "Wrong buffer for field `%s' (%d of %d) "
@@ -700,21 +702,21 @@ static void *__req_capsule_get(const struct req_capsule *pill,
         return value;
 }
 
-void *req_capsule_client_get(const struct req_capsule *pill,
+void *req_capsule_client_get(struct req_capsule *pill,
                              const struct req_msg_field *field)
 {
         return __req_capsule_get(pill, field, RCL_CLIENT);
 }
 EXPORT_SYMBOL(req_capsule_client_get);
 
-void *req_capsule_server_get(const struct req_capsule *pill,
+void *req_capsule_server_get(struct req_capsule *pill,
                              const struct req_msg_field *field)
 {
         return __req_capsule_get(pill, field, RCL_SERVER);
 }
 EXPORT_SYMBOL(req_capsule_server_get);
 
-const void *req_capsule_other_get(const struct req_capsule *pill,
+const void *req_capsule_other_get(struct req_capsule *pill,
                                   const struct req_msg_field *field)
 {
         return __req_capsule_get(pill, field, pill->rc_loc ^ 1);
@@ -767,6 +769,8 @@ void req_capsule_extend(struct req_capsule *pill, const struct req_format *fmt)
                 LASSERT(FMT_FIELD(fmt, i, j)->rmf_size >=
                         FMT_FIELD(old, i, j)->rmf_size);
         }
+        /* last field should be returned to the unswabbed state */
+        pill->rc_swabbed &= ~(__u32)(1 << j);
         pill->rc_fmt = fmt;
 }
 EXPORT_SYMBOL(req_capsule_extend);