completed.
ptl_md_t rq_req_md;
ptl_handle_md_t rq_req_md_h;
+ struct lustre_peer rq_peer; /* XXX see service.c can this be factored away? */
+ struct obd_export *rq_export;
struct ptlrpc_connection *rq_connection;
struct ptlrpc_client *rq_client;
struct ptlrpc_service *rq_svc;
struct lustre_handle export_import; /* client handle */
struct list_head export_chain;
struct obd_device *export_obd;
+ struct ptlrpc_connection *export_connection;
unsigned int export_id;
void *export_data; /* device specific data */
};
{
struct ost_body *body;
struct obd_device *target;
+ struct obd_export *export;
struct obd_conn conn;
char *uuid;
int rc, size = sizeof(*body), i;
req->rq_repmsg->addr = conn.addr;
req->rq_repmsg->cookie = conn.cookie;
+ export = gen_client(&conn);
+ if (!export)
+ LBUG();
+
+ 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);
body = lustre_msg_buf(req->rq_repmsg, 0);
body->connid = conn.oc_id;
GOTO(out, rc = -EINVAL);
}
- if (req->rq_reqmsg->opc != OST_CONNECT) {
- struct obd_export *export;
- export = gen_client((struct obd_conn *) req->rq_reqmsg);
- if (!export)
- GOTO(out, rc = -ENOTCONN);
- if (strcmp(req->rq_obd->obd_type->typ_name, "ost") != 0)
- GOTO(out, rc = -EINVAL);
- }
+ if (req->rq_reqmsg->opc != OST_CONNECT &&
+ req->rq_export == NULL)
+ GOTO(out, rc = -ENOTCONN);
+
+ if (strcmp(req->rq_obd->obd_type->typ_name, "ost") != 0)
+ GOTO(out, rc = -EINVAL);
switch (req->rq_reqmsg->opc) {
case OST_CONNECT:
/* FIXME: this NI should be the incoming NI.
* We don't know how to find that from here. */
peer.peer_ni = svc->srv_self.peer_ni;
+ request.rq_export = gen_client((struct obd_conn *) request.rq_reqmsg);
- if (request.rq_reqmsg->conn2) {
- request.rq_connection =
- (void *)(unsigned long)request.rq_reqmsg->conn2;
- ptlrpc_connection_addref(request.rq_connection);
- } else {
- /*
- PHIL? should we perhaps only do this when
- we get an incoming connmgr_connect request?
- */
+ if (request.rq_export) {
+ request.rq_connection = request.rq_export->export_connection;
+ ptlrpc_connection_addref(request.rq_connection);
+ } else {
request.rq_connection = ptlrpc_get_connection(&peer);
- if (!request.rq_connection)
- LBUG();
}
spin_unlock(&svc->srv_lock);
rc = svc->srv_handler(&request);
- ptlrpc_put_connection(request.rq_connection);
+ ptlrpc_put_connection(request.rq_connection);
ptl_handled_rpc(svc, start);
return rc;
}