Whamcloud - gitweb
Minor bug fixes to get export handles used by the DLM. I believe the
authorbraam <braam>
Sat, 29 Jun 2002 12:53:02 +0000 (12:53 +0000)
committerbraam <braam>
Sat, 29 Jun 2002 12:53:02 +0000 (12:53 +0000)
head is pretty close to where it was before in functionality, but the
cleanups can now continue further.

18 files changed:
lustre/include/linux/lustre_dlm.h
lustre/include/linux/lustre_idl.h
lustre/include/linux/obd.h
lustre/ldlm/ldlm_lockd.c
lustre/ldlm/ldlm_request.c
lustre/ldlm/ldlm_resource.c
lustre/ldlm/ldlm_test.c
lustre/lib/l_net.c
lustre/llite/file.c
lustre/mdc/mdc_request.c
lustre/mds/handler.c
lustre/mds/mds_reint.c
lustre/obdclass/class_obd.c
lustre/obdclass/genops.c
lustre/obdfilter/filter.c
lustre/osc/osc_request.c
lustre/ptlrpc/client.c
lustre/ptlrpc/pack_generic.c

index 6ace006..572ed16 100644 (file)
@@ -268,6 +268,7 @@ int ldlm_lock_change_resource(struct ldlm_lock *lock, __u64 new_resid[3]);
 /* ldlm_request.c */
 int ldlm_cli_enqueue(struct ptlrpc_client *cl, 
                      struct ptlrpc_connection *peer,
+                     struct lustre_handle *connh,
                      struct ptlrpc_request *req,
                      struct ldlm_namespace *ns,
                      struct lustre_handle *parent_lock_handle,
@@ -282,9 +283,9 @@ int ldlm_cli_enqueue(struct ptlrpc_client *cl,
                      struct lustre_handle *lockh);
 int ldlm_server_ast(struct lustre_handle *lockh, struct ldlm_lock_desc *new,
                     void *data, __u32 data_len);
-int ldlm_cli_convert(struct ptlrpc_client *, struct lustre_handle *,
+int ldlm_cli_convert(struct ptlrpc_client *, struct lustre_handle *, struct lustre_handle *connh, 
                      int new_mode, int *flags);
-int ldlm_cli_cancel(struct lustre_handle *);
+int ldlm_cli_cancel(struct lustre_handle *lockh, struct lustre_handle *connh);
 
 #endif /* __KERNEL__ */
 
index ca6c12b..4c7b22b 100644 (file)
@@ -54,15 +54,14 @@ struct lustre_handle {
 struct lustre_msg {
         __u64 addr;
         __u64 cookie; /* security token */
-        __u64 conn2; /* pointer to ptlrpc_connection: should go */
-
+        __u32 magic;
+        __u32 version;
         __u64 last_rcvd;
         __u64 last_committed;
         __u64 transno;
         __u32 opc;
         __u32 status;
         __u32 type;
-        __u32 target_id;
         __u32   bufcount;
         __u32   buflens[0];
 };
index ce5fdec..ee5af2d 100644 (file)
@@ -39,7 +39,6 @@ struct obd_conn {
         __u64 addr;
         __u64 cookie;
         struct obd_device *oc_dev;
-        uint32_t oc_id;
 };
 
 /* Individual type definitions */
@@ -87,6 +86,7 @@ struct mds_obd {
         struct ptlrpc_service *mds_service;
         struct ptlrpc_client *mds_ldlm_client; /* to be an LDLM client */
         struct ptlrpc_connection *mds_ldlm_conn; /* to be an LDLM client */
+        struct obd_conn mds_connh; /* to be one's on DLM client */
 
         char *mds_fstype;
         struct super_block *mds_sb;
index bf70eb0..496488f 100644 (file)
@@ -21,10 +21,9 @@ extern kmem_cache_t *ldlm_lock_slab;
 extern int (*mds_reint_p)(int offset, struct ptlrpc_request *req);
 extern int (*mds_getattr_name_p)(int offset, struct ptlrpc_request *req);
 
-static int ldlm_handle_enqueue(struct obd_device *obddev,
-                               struct ptlrpc_service *svc,
-                               struct ptlrpc_request *req)
+static int ldlm_handle_enqueue(struct ptlrpc_request *req)
 {
+        struct obd_device *obddev = req->rq_export->export_obd;
         struct ldlm_reply *dlm_rep;
         struct ldlm_request *dlm_req;
         int rc, size = sizeof(*dlm_rep), cookielen = 0;
@@ -92,7 +91,7 @@ static int ldlm_handle_enqueue(struct obd_device *obddev,
         req->rq_status = err;
         CDEBUG(D_INFO, "err = %d\n", err);
 
-        if (ptlrpc_reply(svc, req))
+        if (ptlrpc_reply(req->rq_svc, req))
                 LBUG();
 
         if (err)
@@ -105,8 +104,7 @@ static int ldlm_handle_enqueue(struct obd_device *obddev,
         return 0;
 }
 
-static int ldlm_handle_convert(struct ptlrpc_service *svc,
-                               struct ptlrpc_request *req)
+static int ldlm_handle_convert(struct ptlrpc_request *req)
 {
         struct ldlm_request *dlm_req;
         struct ldlm_reply *dlm_rep;
@@ -132,7 +130,7 @@ static int ldlm_handle_convert(struct ptlrpc_service *svc,
                                   &dlm_rep->lock_flags);
                 req->rq_status = 0;
         }
-        if (ptlrpc_reply(svc, req) != 0)
+        if (ptlrpc_reply(req->rq_svc, req) != 0)
                 LBUG();
 
         ldlm_reprocess_all(lock->l_resource);
@@ -142,8 +140,7 @@ static int ldlm_handle_convert(struct ptlrpc_service *svc,
         RETURN(0);
 }
 
-static int ldlm_handle_cancel(struct ptlrpc_service *svc,
-                              struct ptlrpc_request *req)
+static int ldlm_handle_cancel(struct ptlrpc_request *req)
 {
         struct ldlm_request *dlm_req;
         struct ldlm_lock *lock;
@@ -166,7 +163,7 @@ static int ldlm_handle_cancel(struct ptlrpc_service *svc,
                 req->rq_status = 0;
         }
 
-        if (ptlrpc_reply(svc, req) != 0)
+        if (ptlrpc_reply(req->rq_svc, req) != 0)
                 LBUG();
 
         ldlm_reprocess_all(lock->l_resource);
@@ -176,8 +173,7 @@ static int ldlm_handle_cancel(struct ptlrpc_service *svc,
         RETURN(0);
 }
 
-static int ldlm_handle_callback(struct ptlrpc_service *svc,
-                                struct ptlrpc_request *req)
+static int ldlm_handle_callback(struct ptlrpc_request *req)
 {
         struct ldlm_request *dlm_req;
         struct ldlm_lock_desc *descp = NULL; 
@@ -195,7 +191,7 @@ static int ldlm_handle_callback(struct ptlrpc_service *svc,
 
         /* We must send the reply first, so that the thread is free to handle
          * any requests made in common_callback() */
-        rc = ptlrpc_reply(svc, req);
+        rc = ptlrpc_reply(req->rq_svc, req);
         if (rc != 0)
                 RETURN(rc);
         
@@ -269,11 +265,9 @@ static int ldlm_handle_callback(struct ptlrpc_service *svc,
         RETURN(0);
 }
 
-static int lustre_handle(struct ptlrpc_request *req)
+static int ldlm_handle(struct ptlrpc_request *req)
 {
-        struct ptlrpc_service *svc = req->rq_svc;
-        struct obd_device *req_dev;
-        int id, rc;
+        int rc;
         ENTRY;
 
         rc = lustre_unpack_msg(req->rq_reqmsg, req->rq_reqlen);
@@ -288,45 +282,45 @@ static int lustre_handle(struct ptlrpc_request *req)
                 GOTO(out, rc = -EINVAL);
         }
 
-        id = req->rq_reqmsg->target_id;
-        if (id < 0 || id > MAX_OBD_DEVICES)
-                GOTO(out, rc = -ENODEV);
-        req_dev = req->rq_obd = &obd_dev[id];
-
+        if (!req->rq_export && 
+            req->rq_reqmsg->opc == LDLM_ENQUEUE) { 
+                CERROR("No export handle for enqueue request.\n");
+                GOTO(out, rc = -ENOTCONN);
+        }
         switch (req->rq_reqmsg->opc) {
         case LDLM_ENQUEUE:
                 CDEBUG(D_INODE, "enqueue\n");
                 OBD_FAIL_RETURN(OBD_FAIL_LDLM_ENQUEUE, 0);
-                rc = ldlm_handle_enqueue(req_dev, svc, req);
+                rc = ldlm_handle_enqueue(req);
                 break;
 
         case LDLM_CONVERT:
                 CDEBUG(D_INODE, "convert\n");
                 OBD_FAIL_RETURN(OBD_FAIL_LDLM_CONVERT, 0);
-                rc = ldlm_handle_convert(svc, req);
+                rc = ldlm_handle_convert(req);
                 break;
 
         case LDLM_CANCEL:
                 CDEBUG(D_INODE, "cancel\n");
                 OBD_FAIL_RETURN(OBD_FAIL_LDLM_CANCEL, 0);
-                rc = ldlm_handle_cancel(svc, req);
+                rc = ldlm_handle_cancel(req);
                 break;
 
         case LDLM_CALLBACK:
                 CDEBUG(D_INODE, "callback\n");
                 OBD_FAIL_RETURN(OBD_FAIL_LDLM_CALLBACK, 0);
-                rc = ldlm_handle_callback(svc, req);
+                rc = ldlm_handle_callback(req);
                 break;
 
         default:
-                rc = ptlrpc_error(svc, req);
+                rc = ptlrpc_error(req->rq_svc, req);
                 RETURN(rc);
         }
 
         EXIT;
 out:
         if (rc)
-                RETURN(ptlrpc_error(svc, req));
+                RETURN(ptlrpc_error(req->rq_svc, req));
         return 0;
 }
 
@@ -384,7 +378,7 @@ static int ldlm_setup(struct obd_device *obddev, obd_count len, void *buf)
         MOD_INC_USE_COUNT;
         ldlm->ldlm_service =
                 ptlrpc_init_svc(64 * 1024, LDLM_REQUEST_PORTAL,
-                                LDLM_REPLY_PORTAL, "self", lustre_handle);
+                                LDLM_REPLY_PORTAL, "self", ldlm_handle);
         if (!ldlm->ldlm_service) {
                 LBUG();
                 GOTO(out_dec, rc = -ENOMEM);
@@ -393,9 +387,6 @@ static int ldlm_setup(struct obd_device *obddev, obd_count len, void *buf)
         for (i = 0; i < LDLM_NUM_THREADS; i++) {
                 rc = ptlrpc_start_thread(obddev, ldlm->ldlm_service,
                                          "lustre_dlm");
-                /* XXX We could just continue if we had started at least
-                 *     a few threads here.
-                 */
                 if (rc) {
                         CERROR("cannot start LDLM thread #%d: rc %d\n", i, rc);
                         LBUG();
index 2c463c5..adc7240 100644 (file)
@@ -13,7 +13,7 @@
 
 #include <linux/lustre_dlm.h>
 
-int ldlm_cli_enqueue(struct ptlrpc_client *cl, struct ptlrpc_connection *conn,
+int ldlm_cli_enqueue(struct ptlrpc_client *cl, struct ptlrpc_connection *conn, struct lustre_handle *connh, 
                      struct ptlrpc_request *req,
                      struct ldlm_namespace *ns,
                      struct lustre_handle *parent_lock_handle,
@@ -45,7 +45,8 @@ int ldlm_cli_enqueue(struct ptlrpc_client *cl, struct ptlrpc_connection *conn,
         LDLM_DEBUG(lock, "client-side enqueue START");
 
         if (req == NULL) {
-                req = ptlrpc_prep_req(cl, conn, LDLM_ENQUEUE, 1, &size, NULL);
+                req = ptlrpc_prep_req2(cl, conn, connh, 
+                                       LDLM_ENQUEUE, 1, &size, NULL);
                 if (!req)
                         GOTO(out, rc = -ENOMEM);
                 req_passed_in = 0;
@@ -187,6 +188,7 @@ int ldlm_server_ast(struct lustre_handle *lockh, struct ldlm_lock_desc *desc,
 }
 
 int ldlm_cli_convert(struct ptlrpc_client *cl, struct lustre_handle *lockh,
+                     struct lustre_handle *connh, 
                      int new_mode, int *flags)
 {
         struct ldlm_request *body;
@@ -204,8 +206,8 @@ int ldlm_cli_convert(struct ptlrpc_client *cl, struct lustre_handle *lockh,
 
         LDLM_DEBUG(lock, "client-side convert");
 
-        req = ptlrpc_prep_req(cl, lock->l_connection, LDLM_CONVERT, 1, &size,
-                              NULL);
+        req = ptlrpc_prep_req(cl, lock->l_connection,
+                               LDLM_CONVERT, 1, &size, NULL);
         if (!req)
                 GOTO(out, rc = -ENOMEM);
 
@@ -244,7 +246,8 @@ int ldlm_cli_convert(struct ptlrpc_client *cl, struct lustre_handle *lockh,
         return rc;
 }
 
-int ldlm_cli_cancel(struct lustre_handle *lockh)
+int ldlm_cli_cancel(struct lustre_handle *lockh, 
+                    struct lustre_handle *connh)
 {
         struct ptlrpc_request *req;
         struct ldlm_lock *lock;
@@ -257,8 +260,8 @@ int ldlm_cli_cancel(struct lustre_handle *lockh)
                 LBUG();
 
         LDLM_DEBUG(lock, "client-side cancel");
-        req = ptlrpc_prep_req(lock->l_client, lock->l_connection, LDLM_CANCEL,
-                              1, &size, NULL);
+        req = ptlrpc_prep_req(lock->l_client, lock->l_connection,
+                              LDLM_CANCEL, 1, &size, NULL);
         if (!req)
                 GOTO(out, rc = -ENOMEM);
 
index a92454d..26d8de9 100644 (file)
@@ -78,7 +78,8 @@ static void cleanup_resource(struct ldlm_resource *res, struct list_head *q)
                 if (client) {
                         struct lustre_handle lockh;
                         ldlm_lock2handle(lock, &lockh);
-                        rc = ldlm_cli_cancel(&lockh);
+                        /* can we get away without a connh here? */
+                        rc = ldlm_cli_cancel(&lockh, NULL);
                         if (rc < 0) {
                                 CERROR("ldlm_cli_cancel: %d\n", rc);
                                 LBUG();
index ed11446..e5df2dd 100644 (file)
@@ -170,7 +170,9 @@ static int ldlm_test_network(struct obd_device *obddev,
         int flags = 0;
         ldlm_error_t err;
 
-        err = ldlm_cli_enqueue(ldlm->ldlm_client, conn, NULL,
+        /* FIXME: this needs a connh as 3rd paramter, before it will work */
+
+        err = ldlm_cli_enqueue(ldlm->ldlm_client, conn, NULL, NULL,
                                obddev->obd_namespace, NULL, res_id, LDLM_EXTENT,
                                &ext, sizeof(ext), LCK_PR, &flags, NULL, NULL, 0,
                                &lockh1);
@@ -219,7 +221,7 @@ static int ldlm_test_main(void *data)
                 get_random_bytes(&random, sizeof(random));
                 lock_mode = random % LCK_NL + 1;
 
-                rc = ldlm_cli_enqueue(&ctl_client, ctl_conn, NULL, ns, NULL,
+                rc = ldlm_cli_enqueue(&ctl_client, ctl_conn, NULL, NULL, ns, NULL,
                                       res_id, LDLM_PLAIN, NULL, 0, lock_mode,
                                       &flags, ldlm_test_callback, NULL, 0,
                                       &lockh);
index 14c905f..488eb95 100644 (file)
@@ -84,7 +84,6 @@ int target_handle_connect(struct ptlrpc_request *req)
 
         req->rq_export = export;
         export->export_connection = req->rq_connection;
-        CDEBUG(D_IOCTL, "rep buffer %p, id %d\n", req->rq_repmsg, conn.oc_id);
         RETURN(0);
 }
 
index 81f879d..52db328 100644 (file)
@@ -220,7 +220,7 @@ static int ll_lock_callback(struct lustre_handle *lockh,
         invalidate_inode_pages(inode);
         up(&inode->i_sem);
 
-        if (ldlm_cli_cancel(lockh) < 0)
+        if (ldlm_cli_cancel(lockh, NULL) < 0)
                 LBUG();
         RETURN(0);
 }
index 7d52db1..996c1de 100644 (file)
@@ -151,7 +151,7 @@ static int mdc_lock_callback(struct lustre_handle *lockh, struct ldlm_lock_desc
                 invalidate_inode_pages(inode);
         }
 
-        rc = ldlm_cli_cancel(lockh);
+        rc = ldlm_cli_cancel(lockh, NULL);
         if (rc < 0) {
                 CERROR("ldlm_cli_cancel: %d\n", rc);
                 LBUG();
@@ -332,7 +332,8 @@ int mdc_enqueue(struct obd_conn *conn, int lock_type, struct lookup_intent *it,
                 RETURN(-1);
         }
 #warning FIXME: the data here needs to be different if a lock was granted for a different inode
-        rc = ldlm_cli_enqueue(mdc->mdc_ldlm_client, mdc->mdc_conn, req,
+        rc = ldlm_cli_enqueue(mdc->mdc_ldlm_client, mdc->mdc_conn, 
+                              NULL, req,
                               obddev->obd_namespace, NULL, res_id, lock_type,
                               NULL, 0, lock_mode, &flags,
                               (void *)mdc_lock_callback, data, datalen, lockh);
@@ -785,7 +786,11 @@ static int mdc_disconnect(struct obd_conn *conn)
         request->rq_replen = lustre_msg_size(0, NULL);
 
         rc = ptlrpc_queue_wait(request);
-        GOTO(out, rc);
+        if (rc) 
+                GOTO(out, rc);
+        rc = gen_disconnect(conn);
+        if (!rc)
+                MOD_DEC_USE_COUNT;
  out:
         ptlrpc_free_req(request);
         return rc;
index fdd413e..69d1f49 100644 (file)
@@ -27,9 +27,9 @@ extern int mds_update_last_rcvd(struct mds_obd *mds, void *handle,
                                 struct ptlrpc_request *req);
 static int mds_cleanup(struct obd_device * obddev);
 
-static struct mds_obd *mds_export2mds(struct obd_export *export)
+inline struct mds_obd *mds_req2mds(struct ptlrpc_request *req)
 {
-        return &export->export_obd->u.mds;
+        return &req->rq_export->export_obd->u.mds;
 }
 
 /* Assumes caller has already pushed into the kernel filesystem context */
@@ -37,7 +37,7 @@ static int mds_sendpage(struct ptlrpc_request *req, struct file *file,
                         __u64 offset)
 {
         int rc = 0;
-        struct mds_obd *mds = &req->rq_obd->u.mds;
+        struct mds_obd *mds = mds_req2mds(req); 
         struct ptlrpc_bulk_desc *desc;
         struct ptlrpc_bulk_page *bulk;
         char *buf;
@@ -178,7 +178,7 @@ static int mds_disconnect(struct obd_conn *conn)
 /* FIXME: the error cases need fixing to avoid leaks */
 static int mds_getstatus(struct ptlrpc_request *req)
 {
-        struct mds_obd *mds = mds_export2mds(req->rq_export); 
+        struct mds_obd *mds = mds_req2mds(req);
         struct mds_body *body;
         struct mds_client_info *mci;
         struct mds_client_data *mcd;
@@ -243,14 +243,14 @@ int mds_lock_callback(struct lustre_handle *lockh, struct ldlm_lock_desc *desc,
                 RETURN(0);
         }
 
-        if (ldlm_cli_cancel(lockh) < 0)
+        if (ldlm_cli_cancel(lockh, NULL) < 0)
                 LBUG();
         RETURN(0);
 }
 
 static int mds_getattr_name(int offset, struct ptlrpc_request *req)
 {
-        struct mds_obd *mds = &req->rq_obd->u.mds;
+        struct mds_obd *mds = mds_req2mds(req);
         struct obd_run_ctxt saved;
         struct mds_body *body;
         struct dentry *de = NULL, *dchild = NULL;
@@ -294,6 +294,7 @@ static int mds_getattr_name(int offset, struct ptlrpc_request *req)
         if (rc == 0) {
                 LDLM_DEBUG_NOLOCK("enqueue res %Lu", res_id[0]);
                 rc = ldlm_cli_enqueue(mds->mds_ldlm_client, mds->mds_ldlm_conn,
+                                      (struct lustre_handle *)&mds->mds_connh, 
                                       NULL, mds->mds_local_namespace, NULL,
                                       res_id, LDLM_PLAIN, NULL, 0, lock_mode,
                                       &flags, (void *)mds_lock_callback,
@@ -350,7 +351,7 @@ out_pre_de:
 
 static int mds_getattr(int offset, struct ptlrpc_request *req)
 {
-        struct mds_obd *mds = &req->rq_obd->u.mds;
+        struct mds_obd *mds = mds_req2mds(req);
         struct obd_run_ctxt saved;
         struct dentry *de;
         struct inode *inode;
@@ -423,7 +424,7 @@ out_pop:
 
 static int mds_statfs(struct ptlrpc_request *req)
 {
-        struct mds_obd *mds = &req->rq_obd->u.mds;
+        struct mds_obd *mds = mds_req2mds(req);
         struct obd_statfs *osfs;
         struct statfs sfs;
         int rc, size = sizeof(*osfs);
@@ -460,7 +461,7 @@ static int mds_open(struct ptlrpc_request *req)
         struct mds_body *body;
         struct file *file;
         struct vfsmount *mnt;
-        struct mds_obd *mds = &req->rq_obd->u.mds;
+        struct mds_obd *mds = mds_req2mds(req);
         struct mds_client_info *mci;
         __u32 flags;
         struct list_head *tmp;
@@ -572,7 +573,7 @@ static int mds_close(struct ptlrpc_request *req)
         struct dentry *de;
         struct mds_body *body;
         struct file *file;
-        struct mds_obd *mds = &req->rq_obd->u.mds;
+        struct mds_obd *mds = mds_req2mds(req);
         struct vfsmount *mnt;
         struct mds_file_data *mfd;
         int rc;
@@ -608,7 +609,7 @@ static int mds_close(struct ptlrpc_request *req)
 
 static int mds_readpage(struct ptlrpc_request *req)
 {
-        struct mds_obd *mds = mds_export2mds(req->rq_export);
+        struct mds_obd *mds = mds_req2mds(req);
         struct vfsmount *mnt;
         struct dentry *de;
         struct file *file;
@@ -773,7 +774,7 @@ out:
                 CERROR("mds: processing error %d\n", rc);
                 ptlrpc_error(req->rq_svc, req);
         } else {
-                struct mds_obd *mds = &req->rq_obd->u.mds;
+                struct mds_obd *mds = mds_req2mds(req);
                 req->rq_repmsg->last_rcvd = HTON__u64(mds->mds_last_rcvd);
                 req->rq_repmsg->last_committed =
                         HTON__u64(mds->mds_last_committed);
@@ -841,6 +842,7 @@ static int mds_recover(struct obd_device *obddev)
 static int mds_setup(struct obd_device *obddev, obd_count len, void *buf)
 {
         struct obd_ioctl_data* data = buf;
+        struct obd_export *export;
         struct mds_obd *mds = &obddev->u.mds;
         struct vfsmount *mnt;
         int rc = 0;
@@ -923,8 +925,18 @@ static int mds_setup(struct obd_device *obddev, obd_count len, void *buf)
         if (rc)
                 GOTO(err_thread, rc);
 
+        rc = gen_connect(&mds->mds_connh, obddev);
+        if (rc)
+                GOTO(err_thread, rc);
+        export = gen_client(&mds->mds_connh);
+        if (!export)
+                LBUG();
+        export->export_connection = mds->mds_ldlm_conn;
+
         RETURN(0);
 
+        
+
 err_thread:
         ptlrpc_stop_all_threads(mds->mds_service);
 err_svc:
@@ -949,6 +961,8 @@ static int mds_cleanup(struct obd_device * obddev)
         struct mds_obd *mds = &obddev->u.mds;
 
         ENTRY;
+        gen_disconnect(&mds->mds_connh);
+
 
         if ( !list_empty(&obddev->obd_exports) ) {
                 CERROR("still has exports!\n");
index 449d594..6d2659f 100644 (file)
@@ -27,6 +27,8 @@
 #include <linux/lustre_dlm.h>
 #include <linux/obd_class.h>
 
+extern inline struct mds_obd *mds_req2mds(struct ptlrpc_request *req);
+
 struct mds_client_info *mds_uuid_to_mci(struct mds_obd *mds, __u8 *uuid)
 {
         struct list_head *p;
@@ -95,7 +97,7 @@ int mds_update_last_rcvd(struct mds_obd *mds, void *handle,
 static int mds_reint_setattr(struct mds_update_record *rec, int offset,
                              struct ptlrpc_request *req)
 {
-        struct mds_obd *mds = &req->rq_obd->u.mds;
+        struct mds_obd *mds = mds_req2mds(req);
         struct dentry *de;
         void *handle;
         int rc = 0;
@@ -137,7 +139,7 @@ static int mds_reint_recreate(struct mds_update_record *rec, int offset,
                             struct ptlrpc_request *req)
 {
         struct dentry *de = NULL;
-        struct mds_obd *mds = &req->rq_obd->u.mds;
+        struct mds_obd *mds = mds_req2mds(req);
         struct dentry *dchild = NULL;
         struct inode *dir;
         int rc = 0;
@@ -186,7 +188,7 @@ static int mds_reint_create(struct mds_update_record *rec, int offset,
                             struct ptlrpc_request *req)
 {
         struct dentry *de = NULL;
-        struct mds_obd *mds = &req->rq_obd->u.mds;
+        struct mds_obd *mds = mds_req2mds(req);
         struct dentry *dchild = NULL;
         struct inode *dir;
         void *handle;
@@ -199,7 +201,7 @@ static int mds_reint_create(struct mds_update_record *rec, int offset,
         if (offset)
                 offset = 1;
 
-        if (strcmp(req->rq_obd->obd_type->typ_name, "mds") != 0)
+        if (strcmp(req->rq_export->export_obd->obd_type->typ_name, "mds") != 0)
                 LBUG();
 
         de = mds_fid2dentry(mds, rec->ur_fid1, NULL);
@@ -219,6 +221,7 @@ static int mds_reint_create(struct mds_update_record *rec, int offset,
         if (rc == 0) {
                 LDLM_DEBUG_NOLOCK("enqueue res %Lu", res_id[0]);
                 rc = ldlm_cli_enqueue(mds->mds_ldlm_client, mds->mds_ldlm_conn,
+                                      (struct lustre_handle *)&mds->mds_connh,
                                       NULL, mds->mds_local_namespace, NULL,
                                       res_id, LDLM_PLAIN, NULL, 0, lock_mode,
                                       &flags, (void *)mds_lock_callback, NULL,
@@ -397,7 +400,7 @@ static int mds_reint_unlink(struct mds_update_record *rec, int offset,
 {
         struct dentry *de = NULL;
         struct dentry *dchild = NULL;
-        struct mds_obd *mds = &req->rq_obd->u.mds;
+        struct mds_obd *mds = mds_req2mds(req);
         struct obdo *obdo;
         struct inode *dir, *inode;
         int lock_mode, flags;
@@ -424,6 +427,7 @@ static int mds_reint_unlink(struct mds_update_record *rec, int offset,
         if (rc == 0) {
                 LDLM_DEBUG_NOLOCK("enqueue res %Lu", res_id[0]);
                 rc = ldlm_cli_enqueue(mds->mds_ldlm_client, mds->mds_ldlm_conn,
+                                      (struct lustre_handle *)&mds->mds_connh,
                                       NULL, mds->mds_local_namespace, NULL,
                                       res_id, LDLM_PLAIN, NULL, 0, lock_mode,
                                       &flags, (void *)mds_lock_callback, NULL,
@@ -515,6 +519,7 @@ out_unlink_de:
                  * locks. */
                 LDLM_DEBUG_NOLOCK("getting EX lock res %Lu", res_id[0]);
                 rc = ldlm_cli_enqueue(mds->mds_ldlm_client, mds->mds_ldlm_conn,
+                                      (struct lustre_handle *)&mds->mds_connh,
                                       NULL, mds->mds_local_namespace, NULL, 
                                       res_id,
                                       LDLM_PLAIN, NULL, 0, LCK_EX, &flags,
@@ -530,7 +535,7 @@ out_unlink_de:
 
         if (!rc) { 
                 ldlm_lock_decref(&lockh, LCK_EX);
-                rc = ldlm_cli_cancel(&lockh);
+                rc = ldlm_cli_cancel(&lockh, NULL);
                 if (rc < 0)
                         CERROR("failed to cancel child inode lock ino "
                                "%Ld: %d\n", res_id[0], rc);
@@ -547,7 +552,7 @@ static int mds_reint_link(struct mds_update_record *rec, int offset,
         struct dentry *de_src = NULL;
         struct dentry *de_tgt_dir = NULL;
         struct dentry *dchild = NULL;
-        struct mds_obd *mds = &req->rq_obd->u.mds;
+        struct mds_obd *mds = mds_req2mds(req);
         void *handle;
         int rc = 0;
         int err;
@@ -615,7 +620,7 @@ static int mds_reint_rename(struct mds_update_record *rec, int offset,
         struct dentry *de_tgtdir = NULL;
         struct dentry *de_old = NULL;
         struct dentry *de_new = NULL;
-        struct mds_obd *mds = &req->rq_obd->u.mds;
+        struct mds_obd *mds = mds_req2mds(req);
         void *handle;
         int rc = 0;
         int err;
@@ -693,7 +698,7 @@ static mds_reinter reinters[REINT_MAX+1] = {
 int mds_reint_rec(struct mds_update_record *rec, int offset,
                   struct ptlrpc_request *req)
 {
-        struct mds_obd *mds = &req->rq_obd->u.mds;
+        struct mds_obd *mds = mds_req2mds(req);
         struct obd_run_ctxt saved;
 
         int rc;
index 9059649..206c8d1 100644 (file)
@@ -463,7 +463,7 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp,
 
                 err = obd_connect(&conn, obd);
 
-                CDEBUG(D_IOCTL, "assigned connection %d\n", conn.oc_id);
+                CDEBUG(D_IOCTL, "assigned export %Lx\n", conn.addr);
                 obd_conn2data(data, &conn);
                 if (err)
                         RETURN(err);
index 089b76e..ef37c75 100644 (file)
@@ -137,7 +137,6 @@ int gen_connect (struct obd_conn *conn, struct obd_device *obd)
         list_add(&(export->export_chain), export->export_obd->obd_exports.prev);
 
         CDEBUG(D_INFO, "connect: new ID %u\n", export->export_id);
-        conn->oc_id = export->export_id;
         conn->addr = (__u64) (unsigned long)export;
         conn->cookie = export->export_cookie;
         return 0;
@@ -152,14 +151,12 @@ int gen_disconnect(struct obd_conn *conn)
         if (!(export = gen_client(conn))) {
                 fixme();
                 CDEBUG(D_IOCTL, "disconnect: attempting to free "
-                       "nonexistent client %u\n", conn->oc_id);
+                       "nonexistent client %Lx\n", conn->addr);
                 RETURN(-EINVAL);
         }
         list_del(&export->export_chain);
         kmem_cache_free(export_cachep, export);
 
-        CDEBUG(D_INFO, "disconnect: ID %u\n", conn->oc_id);
-
         RETURN(0);
 } /* gen_obd_disconnect */
 
index 2268719..b150729 100644 (file)
@@ -510,7 +510,7 @@ static int filter_getattr(struct obd_conn *conn, struct obdo *oa)
         ENTRY;
 
         if (!gen_client(conn)) {
-                CDEBUG(D_IOCTL, "fatal: invalid client %u\n", conn->oc_id);
+                CDEBUG(D_IOCTL, "fatal: invalid client %Lx\n", conn->addr);
                 RETURN(-EINVAL);
         }
 
@@ -575,7 +575,7 @@ static int filter_open(struct obd_conn *conn, struct obdo *oa)
         /* ENTRY; */
 
         if (!gen_client(conn)) {
-                CDEBUG(D_IOCTL, "fatal: invalid client %u\n", conn->oc_id);
+                CDEBUG(D_IOCTL, "fatal: invalid client %Lx\n", conn->addr);
                 RETURN(-EINVAL);
         }
 
@@ -595,7 +595,7 @@ static int filter_close(struct obd_conn *conn, struct obdo *oa)
         /* ENTRY; */
 
         if (!gen_client(conn)) {
-                CDEBUG(D_IOCTL, "fatal: invalid client %u\n", conn->oc_id);
+                CDEBUG(D_IOCTL, "fatal: invalid client %Lx\n", conn->addr);
                 RETURN(-EINVAL);
         }
 
@@ -625,7 +625,7 @@ static int filter_create(struct obd_conn* conn, struct obdo *oa)
         ENTRY;
 
         if (!gen_client(conn)) {
-                CERROR("invalid client %u\n", conn->oc_id);
+                CERROR("invalid client %Lx\n", conn->addr);
                 return -EINVAL;
         }
 
@@ -666,7 +666,7 @@ static int filter_destroy(struct obd_conn *conn, struct obdo *oa)
         ENTRY;
 
         if (!(export = gen_client(conn))) {
-                CERROR("invalid client %u\n", conn->oc_id);
+                CERROR("invalid client %Lx\n", conn->addr);
                 RETURN(-EINVAL);
         }
 
@@ -732,7 +732,7 @@ static int filter_pgcache_brw(int cmd, struct obd_conn *conn, obd_count num_oa,
         ENTRY;
 
         if (!gen_client(conn)) {
-                CDEBUG(D_IOCTL, "invalid client %u\n", conn->oc_id);
+                CDEBUG(D_IOCTL, "invalid client %Lx\n", conn->addr);
                 RETURN(-EINVAL);
         }
 
@@ -1291,7 +1291,7 @@ static int filter_statfs(struct obd_conn *conn, struct statfs * statfs)
         ENTRY;
 
         if (!gen_client(conn)) {
-                CDEBUG(D_IOCTL, "invalid client %u\n", conn->oc_id);
+                CDEBUG(D_IOCTL, "invalid client %Lx\n", conn->addr);
                 RETURN(-EINVAL);
         }
 
@@ -1310,7 +1310,7 @@ static int filter_get_info(struct obd_conn *conn, obd_count keylen,
         ENTRY;
 
         if (!(export = gen_client(conn))) {
-                CDEBUG(D_IOCTL, "invalid client %u\n", conn->oc_id);
+                CDEBUG(D_IOCTL, "invalid client %Lx\n", conn->addr);
                 RETURN(-EINVAL);
         }
 
index daba0ce..b20654e 100644 (file)
@@ -142,7 +142,6 @@ static int osc_getattr(struct obd_conn *conn, struct obdo *oa)
 
         body = lustre_msg_buf(request->rq_reqmsg, 0);
         memcpy(&body->oa, oa, sizeof(*oa));
-        body->connid = conn->oc_id;
         body->oa.o_valid = ~0;
 
         request->rq_replen = lustre_msg_size(1, &size);
@@ -183,7 +182,6 @@ static int osc_open(struct obd_conn *conn, struct obdo *oa)
 
         body = lustre_msg_buf(request->rq_reqmsg, 0);
         memcpy(&body->oa, oa, sizeof(*oa));
-        body->connid = conn->oc_id;
         body->oa.o_valid = (OBD_MD_FLMODE | OBD_MD_FLID);
 
         request->rq_replen = lustre_msg_size(1, &size);
@@ -222,7 +220,6 @@ static int osc_close(struct obd_conn *conn, struct obdo *oa)
 
         body = lustre_msg_buf(request->rq_reqmsg, 0);
         memcpy(&body->oa, oa, sizeof(*oa));
-        body->connid = conn->oc_id;
 
         request->rq_replen = lustre_msg_size(1, &size);
 
@@ -260,7 +257,6 @@ static int osc_setattr(struct obd_conn *conn, struct obdo *oa)
 
         body = lustre_msg_buf(request->rq_reqmsg, 0);
         memcpy(&body->oa, oa, sizeof(*oa));
-        body->connid = conn->oc_id;
 
         request->rq_replen = lustre_msg_size(1, &size);
 
@@ -297,7 +293,6 @@ static int osc_create(struct obd_conn *conn, struct obdo *oa)
 
         body = lustre_msg_buf(request->rq_reqmsg, 0);
         memcpy(&body->oa, oa, sizeof(*oa));
-        body->connid = conn->oc_id;
 
         request->rq_replen = lustre_msg_size(1, &size);
 
@@ -346,7 +341,6 @@ static int osc_punch(struct obd_conn *conn, struct obdo *oa, obd_size count,
 
         body = lustre_msg_buf(request->rq_reqmsg, 0);
         memcpy(&body->oa, oa, sizeof(*oa));
-        body->connid = conn->oc_id;
         body->oa.o_blocks = count;
         body->oa.o_valid |= OBD_MD_FLBLOCKS;
 
@@ -388,7 +382,6 @@ static int osc_destroy(struct obd_conn *conn, struct obdo *oa)
 
         body = lustre_msg_buf(request->rq_reqmsg, 0);
         memcpy(&body->oa, oa, sizeof(*oa));
-        body->connid = conn->oc_id;
         body->oa.o_valid = ~0;
 
         request->rq_replen = lustre_msg_size(1, &size);
@@ -684,8 +677,8 @@ static int osc_enqueue(struct obd_conn *oconn,
                        struct lustre_handle *lockh)
 {
         struct obd_device *obddev = gen_conn2obd(oconn);
+        struct osc_obd *osc = &obddev->u.osc;
         struct ptlrpc_connection *conn;
-        struct osc_obd *osc = &gen_conn2obd(oconn)->u.osc;
         struct ptlrpc_client *cl;
         struct ldlm_extent *extent = extentp;
         int rc;
@@ -727,14 +720,16 @@ static int osc_enqueue(struct obd_conn *oconn,
                 if (mode == LCK_PR)
                         return 0;
 
-                rc = ldlm_cli_convert(cl, lockh, mode, &flags);
+                rc = ldlm_cli_convert(cl, lockh, &osc->osc_connh, 
+                                      mode, &flags);
                 if (rc)
                         LBUG();
 
                 return rc;
         }
 
-        rc = ldlm_cli_enqueue(cl, conn, NULL, obddev->obd_namespace,
+        rc = ldlm_cli_enqueue(cl, conn, &osc->osc_connh, 
+                              NULL, obddev->obd_namespace,
                               parent_lock, res_id, type, extent, sizeof(extent),
                               mode, flags, callback, data, datalen, lockh);
         return rc;
index 2746c59..b05d193 100644 (file)
@@ -177,11 +177,8 @@ struct ptlrpc_request *ptlrpc_prep_req(struct ptlrpc_client *cl,
         request->rq_type = PTL_RPC_TYPE_REQUEST;
         request->rq_connection = ptlrpc_connection_addref(conn);
 
-        request->rq_reqmsg->conn2 = (__u64)(unsigned long)conn->c_remote_conn;
-        //request->rq_reqmsg->token = conn->c_remote_token;
         request->rq_reqmsg->opc = HTON__u32(opcode);
         request->rq_reqmsg->type = HTON__u32(PTL_RPC_MSG_REQUEST);
-        request->rq_reqmsg->target_id = HTON__u32(cl->cli_target_devno);
 
         INIT_LIST_HEAD(&request->rq_list);
         INIT_LIST_HEAD(&request->rq_multi);
index 87f5e04..dae7362 100644 (file)
@@ -86,7 +86,6 @@ int lustre_unpack_msg(struct lustre_msg *m, int len)
         m->bufcount = NTOH__u32(m->bufcount);
         m->last_rcvd = NTOH__u64(m->last_rcvd);
         m->last_committed = NTOH__u64(m->last_committed);
-        m->target_id = NTOH__u32(m->target_id);
 
         required_len = size_round(sizeof(*m) + m->bufcount * sizeof(__u32));
         if (len < required_len)