Whamcloud - gitweb
(1) adjust init order of mdt_init0.
authorfanyong <fanyong>
Wed, 27 Sep 2006 03:39:45 +0000 (03:39 +0000)
committerfanyong <fanyong>
Wed, 27 Sep 2006 03:39:45 +0000 (03:39 +0000)
(2) fix position of packing remote perm for open.

lustre/mdt/mdt_handler.c
lustre/mdt/mdt_open.c

index 5f003ec..c129286 100644 (file)
@@ -388,14 +388,27 @@ static int mdt_getattr(struct mdt_thread_info *info)
 {
         int rc;
         struct mdt_object *obj;
+        struct mdt_body *reqbody;
 
         obj = info->mti_object;
         LASSERT(obj != NULL);
         LASSERT(lu_object_assert_exists(&obj->mot_obj.mo_lu));
         ENTRY;
 
+        reqbody = req_capsule_client_get(&info->mti_pill, &RMF_MDT_BODY);
+        if (reqbody == NULL)
+                RETURN(-EFAULT);
+
+        if (reqbody->valid & OBD_MD_FLRMTPERM) {
+                rc = mdt_init_ucred(info, reqbody);
+                if (rc)
+                        RETURN(rc);
+        }
+
         rc = mdt_getattr_internal(info, obj);
         mdt_shrink_reply(info, REPLY_REC_OFF + 1);
+        if (reqbody->valid & OBD_MD_FLRMTPERM) 
+                mdt_exit_ucred(info);
         RETURN(rc);
 }
 
@@ -2998,15 +3011,15 @@ static void mdt_fini(const struct lu_context *ctx, struct mdt_device *m)
         ENTRY;
         target_cleanup_recovery(m->mdt_md_dev.md_lu_dev.ld_obd);
 
+        ping_evictor_stop();
+        mdt_stop_ptlrpc_service(m);
+
         upcall_cache_cleanup(m->mdt_rmtacl_cache);
         m->mdt_rmtacl_cache = NULL;
 
         upcall_cache_cleanup(m->mdt_identity_cache);
         m->mdt_identity_cache = NULL;
 
-        ping_evictor_stop();
-        mdt_stop_ptlrpc_service(m);
-
         if (m->mdt_namespace != NULL) {
                 ldlm_namespace_free(m->mdt_namespace, 0);
                 d->ld_obd->obd_namespace = m->mdt_namespace = NULL;
@@ -3122,14 +3135,6 @@ static int mdt_init0(const struct lu_context *ctx, struct mdt_device *m,
         ldlm_register_intent(m->mdt_namespace, mdt_intent_policy);
         /* set obd_namespace for compatibility with old code */
         obd->obd_namespace = m->mdt_namespace;
-        rc = mdt_start_ptlrpc_service(m);
-        if (rc)
-                GOTO(err_free_ns, rc);
-
-        ping_evictor_start();
-        rc = mdt_fs_setup(ctx, m, obd);
-        if (rc)
-                GOTO(err_stop_service, rc);
 
         m->mdt_identity_cache = upcall_cache_init(obd->obd_name,
                                                   MDT_IDENTITY_UPCALL_PATH,
@@ -3137,7 +3142,7 @@ static int mdt_init0(const struct lu_context *ctx, struct mdt_device *m,
         if (IS_ERR(m->mdt_identity_cache)) {
                 rc = PTR_ERR(m->mdt_identity_cache);
                 m->mdt_identity_cache = NULL;
-                GOTO(err_fs, rc);
+                GOTO(err_free_ns, rc);
         }
 
         m->mdt_rmtacl_cache = upcall_cache_init(obd->obd_name,
@@ -3146,9 +3151,18 @@ static int mdt_init0(const struct lu_context *ctx, struct mdt_device *m,
         if (IS_ERR(m->mdt_rmtacl_cache)) {
                 rc = PTR_ERR(m->mdt_rmtacl_cache);
                 m->mdt_rmtacl_cache = NULL;
-                GOTO(err_fs, rc);
+                GOTO(err_free_ns, rc);
         }
 
+        rc = mdt_start_ptlrpc_service(m);
+        if (rc)
+                GOTO(err_free_ns, rc);
+
+        ping_evictor_start();
+        rc = mdt_fs_setup(ctx, m, obd);
+        if (rc)
+                GOTO(err_stop_service, rc);
+
         if(obd->obd_recovering == 0)
                 mdt_postrecov(ctx, m);
 
@@ -3156,15 +3170,13 @@ static int mdt_init0(const struct lu_context *ctx, struct mdt_device *m,
 
         RETURN(0);
 
-err_fs:
+err_stop_service:
+        mdt_stop_ptlrpc_service(m);
+err_free_ns:
         upcall_cache_cleanup(m->mdt_rmtacl_cache);
         m->mdt_rmtacl_cache = NULL;
         upcall_cache_cleanup(m->mdt_identity_cache);
         m->mdt_identity_cache = NULL;
-        mdt_fs_cleanup(ctx, m);
-err_stop_service:
-        mdt_stop_ptlrpc_service(m);
-err_free_ns:
         ldlm_namespace_free(m->mdt_namespace, 0);
         obd->obd_namespace = m->mdt_namespace = NULL;
 err_fini_seq:
index 268ee8e..6a03a01 100644 (file)
@@ -337,13 +337,23 @@ static int mdt_mfd_open(struct mdt_thread_info *info,
         mdt_pack_attr2body(repbody, la, mdt_object_fid(o));
         mdt_body_reverse_idmap(info, repbody);
 
+        if (med->med_rmtclient) {
+                void *buf = req_capsule_server_get(&info->mti_pill, &RMF_ACL);
+
+                rc = mdt_pack_remote_perm(info, o, buf);
+                if (rc == 0) {
+                        repbody->valid |= OBD_MD_FLRMTPERM;
+                        repbody->aclsize = sizeof(struct mdt_remote_perm);
+                }
+        }
+
         /* if we are following a symlink, don't open; and
          * do not return open handle for special nodes as client required
          */
         if (islnk || (!isreg && !isdir &&
             (req->rq_export->exp_connect_flags & OBD_CONNECT_NODEVOH))) {
                 lustre_msg_set_transno(req->rq_repmsg, 0);
-                GOTO(out, rc = 0);
+                RETURN(0);
         }
 
         mdt_set_disposition(info, rep, DISP_OPEN_OPEN);
@@ -406,7 +416,7 @@ static int mdt_mfd_open(struct mdt_thread_info *info,
         
                 if (mfd != NULL) {
                         repbody->handle.cookie = mfd->mfd_handle.h_cookie;
-                        GOTO(out, rc = 0);
+                        RETURN(0);
                 }
         }
 
@@ -450,21 +460,6 @@ static int mdt_mfd_open(struct mdt_thread_info *info,
         } else
                 rc = -ENOMEM;
 
-out:
-        if (rc == 0) {
-                if (med->med_rmtclient) {
-                        void *buf = req_capsule_server_get(&info->mti_pill,
-                                                           &RMF_ACL);
-
-                        rc = mdt_pack_remote_perm(info, o, buf);
-                        if (rc == 0) {
-                                repbody->valid |= OBD_MD_FLRMTPERM;
-                                repbody->aclsize =
-                                                sizeof(struct mdt_remote_perm);
-                        }
-                }
-        }
-
         RETURN(rc);
 }