*/
int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg)
{
- struct client_obd *cli = &obddev->u.cli;
- struct obd_import *imp;
- struct obd_uuid server_uuid;
- int rq_portal, rp_portal, connect_op;
- char *name = obddev->obd_type->typ_name;
- ldlm_ns_type_t ns_type = LDLM_NS_TYPE_UNKNOWN;
- int rc;
- ENTRY;
+ struct client_obd *cli = &obddev->u.cli;
+ struct obd_import *imp;
+ struct obd_uuid server_uuid;
+ int rq_portal, rp_portal, connect_op;
+ char *name = obddev->obd_type->typ_name;
+ ldlm_ns_type_t ns_type = LDLM_NS_TYPE_UNKNOWN;
+ int rc;
+ char *cli_name = lustre_cfg_buf(lcfg, 0);
+ ENTRY;
/* In a more perfect world, we would hang a ptlrpc_client off of
* obd_type and just use the values from there. */
rq_portal = MDS_REQUEST_PORTAL;
rp_portal = MDC_REPLY_PORTAL;
connect_op = MDS_CONNECT;
- cli->cl_sp_me = LUSTRE_SP_CLI;
+ if (is_lwp_on_ost(cli_name))
+ cli->cl_sp_me = LUSTRE_SP_OST;
+ else if (is_lwp_on_mdt(cli_name))
+ cli->cl_sp_me = LUSTRE_SP_MDT;
+ else
+ cli->cl_sp_me = LUSTRE_SP_CLI;
cli->cl_sp_to = LUSTRE_SP_MDT;
ns_type = LDLM_NS_TYPE_MDC;
} else if (!strcmp(name, LUSTRE_OSP_NAME)) {
rq_portal = OST_REQUEST_PORTAL;
}
rp_portal = OSC_REPLY_PORTAL;
- cli->cl_sp_me = LUSTRE_SP_CLI;
+ cli->cl_sp_me = LUSTRE_SP_MDT;
} else if (!strcmp(name, LUSTRE_MGC_NAME)) {
rq_portal = MGS_REQUEST_PORTAL;
rp_portal = MGC_REPLY_PORTAL;
else
cli->cl_max_rpcs_in_flight = OBD_MAX_RIF_DEFAULT;
}
+
+ spin_lock_init(&cli->cl_mod_rpcs_lock);
+ spin_lock_init(&cli->cl_mod_rpcs_hist.oh_lock);
+ cli->cl_max_mod_rpcs_in_flight = 0;
+ cli->cl_mod_rpcs_in_flight = 0;
+ cli->cl_close_rpcs_in_flight = 0;
+ init_waitqueue_head(&cli->cl_mod_rpcs_waitq);
+ cli->cl_mod_tag_bitmap = NULL;
+
+ if (connect_op == MDS_CONNECT) {
+ cli->cl_max_mod_rpcs_in_flight = cli->cl_max_rpcs_in_flight - 1;
+ OBD_ALLOC(cli->cl_mod_tag_bitmap,
+ BITS_TO_LONGS(OBD_MAX_RIF_MAX) * sizeof(long));
+ if (cli->cl_mod_tag_bitmap == NULL)
+ GOTO(err, rc = -ENOMEM);
+ }
+
rc = ldlm_get_ref();
if (rc) {
CERROR("ldlm_get_ref failed: %d\n", rc);
err_ldlm:
ldlm_put_ref();
err:
+ if (cli->cl_mod_tag_bitmap != NULL)
+ OBD_FREE(cli->cl_mod_tag_bitmap,
+ BITS_TO_LONGS(OBD_MAX_RIF_MAX) * sizeof(long));
+ cli->cl_mod_tag_bitmap = NULL;
RETURN(rc);
}
int client_obd_cleanup(struct obd_device *obddev)
{
+ struct client_obd *cli = &obddev->u.cli;
ENTRY;
ldlm_namespace_free_post(obddev->obd_namespace);
LASSERT(obddev->u.cli.cl_import == NULL);
ldlm_put_ref();
+
+ if (cli->cl_mod_tag_bitmap != NULL)
+ OBD_FREE(cli->cl_mod_tag_bitmap,
+ BITS_TO_LONGS(OBD_MAX_RIF_MAX) * sizeof(long));
+ cli->cl_mod_tag_bitmap = NULL;
+
RETURN(0);
}
EXPORT_SYMBOL(client_obd_cleanup);
struct obd_connect_data *ocd;
struct lustre_handle conn = { 0 };
int rc;
+ bool is_mdc = false;
ENTRY;
*exp = NULL;
ocd = &imp->imp_connect_data;
if (data) {
*ocd = *data;
+ is_mdc = strncmp(imp->imp_obd->obd_type->typ_name,
+ LUSTRE_MDC_NAME, 3) == 0;
+ if (is_mdc)
+ data->ocd_connect_flags |= OBD_CONNECT_MULTIMODRPCS;
imp->imp_connect_flags_orig = data->ocd_connect_flags;
}
ocd->ocd_connect_flags, "old "LPX64", new "LPX64"\n",
data->ocd_connect_flags, ocd->ocd_connect_flags);
data->ocd_connect_flags = ocd->ocd_connect_flags;
+ /* clear the flag as it was not set and is not known
+ * by upper layers */
+ if (is_mdc)
+ data->ocd_connect_flags &= ~OBD_CONNECT_MULTIMODRPCS;
}
ptlrpc_pinger_add_import(imp);
if (exp->exp_imp_reverse)
ptlrpc_cleanup_imp(exp->exp_imp_reverse);
- if (exp->exp_obd->obd_namespace != NULL)
- ldlm_cancel_locks_for_export(exp);
+ ldlm_bl_thread_wakeup();
/* complete all outstanding replies */
spin_lock(&exp->exp_lock);
__u64 transno = lustre_msg_get_transno(req->rq_reqmsg);
struct obd_export *exp = req->rq_export;
struct ptlrpc_request *reqiter;
+ struct ptlrpc_request *dup_req = NULL;
int dup = 0;
LASSERT(exp);
list_for_each_entry(reqiter, &exp->exp_req_replay_queue,
rq_replay_list) {
if (lustre_msg_get_transno(reqiter->rq_reqmsg) == transno) {
+ dup_req = reqiter;
dup = 1;
break;
}
(MSG_RESENT | MSG_REPLAY)) != (MSG_RESENT | MSG_REPLAY))
CERROR("invalid flags %x of resent replay\n",
lustre_msg_get_flags(req->rq_reqmsg));
+
+ if (lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY) {
+ __u32 new_conn;
+
+ new_conn = lustre_msg_get_conn_cnt(req->rq_reqmsg);
+ if (new_conn >
+ lustre_msg_get_conn_cnt(dup_req->rq_reqmsg))
+ lustre_msg_set_conn_cnt(dup_req->rq_reqmsg,
+ new_conn);
+ }
} else {
list_add_tail(&req->rq_replay_list,
&exp->exp_req_replay_queue);
static int target_send_reply_msg(struct ptlrpc_request *req,
int rc, int fail_id)
{
- if (OBD_FAIL_CHECK_ORSET(fail_id & ~OBD_FAIL_ONCE, OBD_FAIL_ONCE)) {
- DEBUG_REQ(D_ERROR, req, "dropping reply");
- return (-ECOMM);
- }
+ if (OBD_FAIL_CHECK_ORSET(fail_id & ~OBD_FAIL_ONCE, OBD_FAIL_ONCE)) {
+ DEBUG_REQ(D_ERROR, req, "dropping reply");
+ return -ECOMM;
+ }
+ if (unlikely(lustre_msg_get_opc(req->rq_reqmsg) == MDS_REINT &&
+ OBD_FAIL_CHECK(OBD_FAIL_MDS_REINT_MULTI_NET_REP)))
+ return -ECOMM;
- if (unlikely(rc)) {
- DEBUG_REQ(D_NET, req, "processing error (%d)", rc);
- req->rq_status = rc;
- return (ptlrpc_send_error(req, 1));
- } else {
- DEBUG_REQ(D_NET, req, "sending reply");
- }
+ if (unlikely(rc)) {
+ DEBUG_REQ(D_NET, req, "processing error (%d)", rc);
+ req->rq_status = rc;
+ return ptlrpc_send_error(req, 1);
+ } else {
+ DEBUG_REQ(D_NET, req, "sending reply");
+ }
- return (ptlrpc_send_reply(req, PTLRPC_REPLY_MAYBE_DIFFICULT));
+ return ptlrpc_send_reply(req, PTLRPC_REPLY_MAYBE_DIFFICULT);
}
void target_send_reply(struct ptlrpc_request *req, int rc, int fail_id)
} else {
if (req->rq_bulk_read)
rc = sptlrpc_svc_wrap_bulk(req, desc);
+
+ if ((exp->exp_connect_data.ocd_connect_flags &
+ OBD_CONNECT_BULK_MBITS) != 0)
+ req->rq_mbits = lustre_msg_get_mbits(req->rq_reqmsg);
+ else /* old version, bulk matchbits is rq_xid */
+ req->rq_mbits = req->rq_xid;
+
if (rc == 0)
rc = ptlrpc_start_bulk_transfer(desc);
}