Whamcloud - gitweb
Fix a little in mdt_reint_open. To be continued.
authorhuanghua <huanghua>
Thu, 1 Jun 2006 10:16:17 +0000 (10:16 +0000)
committerhuanghua <huanghua>
Thu, 1 Jun 2006 10:16:17 +0000 (10:16 +0000)
lustre/mdt/mdt_handler.c
lustre/mdt/mdt_internal.h
lustre/mdt/mdt_reint.c

index c2e772a..33658aa 100644 (file)
@@ -63,7 +63,6 @@ unsigned long mdt_num_threads;
 
 static int                    mdt_handle    (struct ptlrpc_request *req);
 static struct mdt_device     *mdt_dev       (struct lu_device *d);
-static struct ptlrpc_request *mdt_info_req  (struct mdt_thread_info *info);
 
 static struct lu_context_key       mdt_thread_key;
 static struct lu_object_operations mdt_obj_ops;
@@ -279,7 +278,7 @@ static struct mdt_device *mdt_dev(struct lu_device *d)
         return container_of0(d, struct mdt_device, mdt_md_dev.md_lu_dev);
 }
 
-static struct ptlrpc_request *mdt_info_req(struct mdt_thread_info *info)
+struct ptlrpc_request *mdt_info_req(struct mdt_thread_info *info)
 {
         return info->mti_pill.rc_req;
 }
index aeee428..e929a14 100644 (file)
@@ -222,6 +222,7 @@ int mdt_reint_unpack(struct mdt_thread_info *info, __u32 op);
 int mdt_reint_rec(struct mdt_thread_info *);
 void mdt_pack_attr2body(struct mdt_body *b, struct lu_attr *attr);
 const struct lu_fid *mdt_object_fid(struct mdt_object *o);
+struct ptlrpc_request *mdt_info_req  (struct mdt_thread_info *info);
 
 #endif /* __KERNEL__ */
 #endif /* _MDT_H */
index c5a4383..33fd4a2 100644 (file)
@@ -205,18 +205,19 @@ static int mdt_reint_open(struct mdt_thread_info *info)
         struct mdt_object      *parent;
         struct mdt_object      *child;
         struct mdt_lock_handle *lh;
-        int result;
-        struct ldlm_reply *ldlm_rep;
-        struct ptlrpc_request *req = info->mti_pill.rc_req;
-        __u32  mode = info->mti_attr.la_mode; /*save a backup*/
+        int                     result;
+        struct ldlm_reply      *ldlm_rep;
+        struct ptlrpc_request  *req = mdt_info_req(info);
+        __u32                   mode = info->mti_attr.la_mode; /*save a backup*/
         struct mdt_reint_reply *rep = &info->mti_reint_rep;
 
-
         ENTRY;
 
         lh = &info->mti_lh[MDT_LH_PARENT];
         lh->mlh_mode = LCK_PW;
 
+        ldlm_rep = req_capsule_server_get(&info->mti_pill, &RMF_DLM_REP);
+
         parent = mdt_object_find_lock(info->mti_ctxt,
                                       mdt, info->mti_rr.rr_fid1,
                                       lh,
@@ -230,12 +231,12 @@ static int mdt_reint_open(struct mdt_thread_info *info)
                 GOTO(out_parent, result);
         }
 
-        ldlm_rep = req_capsule_server_get(&info->mti_pill, &RMF_DLM_REP);
         intent_set_disposition(ldlm_rep, DISP_LOOKUP_EXECD);
+
         if (result == -ENOENT)
-                intent_set_disposition(ldlm_rep, DISP_LOOKUP_POS);
-        else
                 intent_set_disposition(ldlm_rep, DISP_LOOKUP_NEG);
+        else
+                intent_set_disposition(ldlm_rep, DISP_LOOKUP_POS);
 
         if (result == -ENOENT) {
                 if(!(info->mti_rr.rr_flags & MDS_OPEN_CREAT))
@@ -275,6 +276,8 @@ static int mdt_reint_open(struct mdt_thread_info *info)
         rep->mrr_body->fid1 = *mdt_object_fid(child);
         rep->mrr_body->valid |= OBD_MD_FLID;
 
+        /* To be continued: we should return "struct lov_mds_md" back*/
+
         /*FIXME add permission checking here */
         if (S_ISREG(mode))
                 ;
@@ -283,7 +286,6 @@ static int mdt_reint_open(struct mdt_thread_info *info)
 
 out_child:
         mdt_object_put(info->mti_ctxt, child);
-
 out_parent:
         mdt_object_unlock(mdt->mdt_namespace, parent, lh);
         mdt_object_put(info->mti_ctxt, parent);