static int osc_connect(struct obd_conn *conn, struct obd_device *obd)
{
struct osc_obd *osc = &obd->u.osc;
+ struct obd_import *import;
struct ptlrpc_request *request;
struct ptlrpc_client *cl;
struct ptlrpc_connection *connection;
int rc, size = sizeof(osc->osc_target_uuid);
ENTRY;
+ OBD_ALLOC(import, sizeof(*import));
+ if (!import)
+ RETURN(-ENOMEM);
+
+ MOD_INC_USE_COUNT;
+ rc = gen_connect(conn, obd);
+ if (rc)
+ GOTO(out, rc);
+
osc_obd2cl(obd, &cl, &connection);
request = ptlrpc_prep_req(cl, connection, OST_CONNECT, 1, &size, &tmp);
if (!request)
body = lustre_msg_buf(request->rq_repmsg, 0);
CDEBUG(D_INODE, "received connid %d\n", body->connid);
+
+ /* XXX: Make this a handle */
+ osc->osc_connh.addr = request->rq_repmsg->addr;
+ osc->osc_connh.cookie = request->rq_repmsg->cookie;
/* This might be redundant. */
cl->cli_target_devno = request->rq_repmsg->target_id;
osc->osc_ldlm_client->cli_target_devno = cl->cli_target_devno;
- /* XXX: Make this a handle */
conn->oc_id = body->connid;
EXIT;
out:
ptlrpc_free_req(request);
+ if (rc)
+ MOD_DEC_USE_COUNT;
return rc;
}
struct ptlrpc_client *cl;
struct ptlrpc_connection *connection;
struct ost_body *body;
+ struct osc_obd *osc = &gen_conn2obd(conn)->u.osc;
int rc, size = sizeof(*body);
ENTRY;
osc_con2cl(conn, &cl, &connection);
- request = ptlrpc_prep_req(cl, connection, OST_DISCONNECT, 1, &size,
- NULL);
+ request = ptlrpc_prep_req2(cl, connection, &osc->osc_connh,
+ OST_DISCONNECT, 1, &size, NULL);
if (!request)
RETURN(-ENOMEM);
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;
{
struct ptlrpc_request *request;
struct ptlrpc_client *cl;
+ struct osc_obd *osc = &gen_conn2obd(conn)->u.osc;
struct ptlrpc_connection *connection;
struct ost_body *body;
int rc, size = sizeof(*body);
ENTRY;
osc_con2cl(conn, &cl, &connection);
- request = ptlrpc_prep_req(cl, connection, OST_GETATTR, 1, &size, NULL);
+ request = ptlrpc_prep_req2(cl, connection, &osc->osc_connh,
+ OST_GETATTR, 1, &size, NULL);
if (!request)
RETURN(-ENOMEM);
{
struct ptlrpc_request *request;
struct ptlrpc_client *cl;
+ struct osc_obd *osc = &gen_conn2obd(conn)->u.osc;
struct ptlrpc_connection *connection;
struct ost_body *body;
int rc, size = sizeof(*body);
ENTRY;
osc_con2cl(conn, &cl, &connection);
- request = ptlrpc_prep_req(cl, connection, OST_OPEN, 1, &size, NULL);
+ request = ptlrpc_prep_req2(cl, connection, &osc->osc_connh,
+ OST_OPEN, 1, &size, NULL);
if (!request)
RETURN(-ENOMEM);
{
struct ptlrpc_request *request;
struct ptlrpc_client *cl;
+ struct osc_obd *osc = &gen_conn2obd(conn)->u.osc;
struct ptlrpc_connection *connection;
struct ost_body *body;
int rc, size = sizeof(*body);
ENTRY;
osc_con2cl(conn, &cl, &connection);
- request = ptlrpc_prep_req(cl, connection, OST_CLOSE, 1, &size, NULL);
+ request = ptlrpc_prep_req2(cl, connection, &osc->osc_connh,
+ OST_CLOSE, 1, &size, NULL);
if (!request)
RETURN(-ENOMEM);
{
struct ptlrpc_request *request;
struct ptlrpc_client *cl;
+ struct osc_obd *osc = &gen_conn2obd(conn)->u.osc;
struct ptlrpc_connection *connection;
struct ost_body *body;
int rc, size = sizeof(*body);
ENTRY;
osc_con2cl(conn, &cl, &connection);
- request = ptlrpc_prep_req(cl, connection, OST_SETATTR, 1, &size, NULL);
+ request = ptlrpc_prep_req2(cl, connection, &osc->osc_connh,
+ OST_SETATTR, 1, &size, NULL);
if (!request)
RETURN(-ENOMEM);
struct ptlrpc_request *request;
struct ptlrpc_client *cl;
struct ptlrpc_connection *connection;
+ struct osc_obd *osc = &gen_conn2obd(conn)->u.osc;
struct ost_body *body;
struct mds_objid *objid;
struct lov_object_id *lov_id;
RETURN(-EINVAL);
}
osc_con2cl(conn, &cl, &connection);
- request = ptlrpc_prep_req(cl, connection, OST_CREATE, 1, &size, NULL);
+ request = ptlrpc_prep_req2(cl, connection, &osc->osc_connh,
+ OST_CREATE, 1, &size, NULL);
if (!request)
RETURN(-ENOMEM);
struct ptlrpc_request *request;
struct ptlrpc_client *cl;
struct ptlrpc_connection *connection;
+ struct osc_obd *osc = &gen_conn2obd(conn)->u.osc;
struct ost_body *body;
int rc, size = sizeof(*body);
ENTRY;
RETURN(-EINVAL);
}
osc_con2cl(conn, &cl, &connection);
- request = ptlrpc_prep_req(cl, connection, OST_PUNCH, 1, &size, NULL);
+ request = ptlrpc_prep_req2(cl, connection, &osc->osc_connh,
+ OST_PUNCH, 1, &size, NULL);
if (!request)
RETURN(-ENOMEM);
struct ptlrpc_request *request;
struct ptlrpc_client *cl;
struct ptlrpc_connection *connection;
+ struct osc_obd *osc = &gen_conn2obd(conn)->u.osc;
struct ost_body *body;
int rc, size = sizeof(*body);
ENTRY;
RETURN(-EINVAL);
}
osc_con2cl(conn, &cl, &connection);
- request = ptlrpc_prep_req(cl, connection, OST_DESTROY, 1, &size, NULL);
+ request = ptlrpc_prep_req2(cl, connection, &osc->osc_connh,
+ OST_DESTROY, 1, &size, NULL);
if (!request)
RETURN(-ENOMEM);
{
struct ptlrpc_client *cl;
struct ptlrpc_connection *connection;
+ struct osc_obd *osc = &gen_conn2obd(conn)->u.osc;
struct ptlrpc_request *request;
struct ost_body *body;
struct list_head *tmp;
size[2] = pages * sizeof(struct niobuf_remote);
osc_con2cl(conn, &cl, &connection);
- request = ptlrpc_prep_req(cl, connection, OST_BRW, 3, size, NULL);
+ request = ptlrpc_prep_req2(cl, connection, &osc->osc_connh,
+ OST_BRW, 3, size, NULL);
if (!request)
GOTO(out, rc = -ENOMEM);
struct ptlrpc_connection *connection;
struct ptlrpc_request *request;
struct ptlrpc_bulk_desc *desc;
+ struct osc_obd *osc = &gen_conn2obd(conn)->u.osc;
struct obd_ioobj ioo;
struct ost_body *body;
struct niobuf_local *local;
RETURN(-ENOMEM);
osc_con2cl(conn, &cl, &connection);
- request = ptlrpc_prep_req(cl, connection, OST_BRW, 3, size, NULL);
+ request = ptlrpc_prep_req2(cl, connection, &osc->osc_connh,
+ OST_BRW, 3, size, NULL);
if (!request)
GOTO(out, rc = -ENOMEM);
body = lustre_msg_buf(request->rq_reqmsg, 0);
{
struct obd_device *obddev = gen_conn2obd(oconn);
struct ptlrpc_connection *conn;
+ struct osc_obd *osc = &gen_conn2obd(oconn)->u.osc;
struct ptlrpc_client *cl;
struct ldlm_extent *extent = extentp;
int rc;