X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fldlm%2Fldlm_lib.c;h=f56b4525e692aa8682d2593c9af03d8f79f18fe1;hb=c2d27a0f12688c0d029880919f8b002e557b540c;hp=448eb9b60fe5443c3194cb853692f51ce55b4012;hpb=1fc013f90175d1e50d7a22b404ad6abd31a43e38;p=fs%2Flustre-release.git diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 448eb9b..f56b452 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -260,14 +260,15 @@ static int osc_on_mdt(char *obdname) */ 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. */ @@ -283,7 +284,12 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg) 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)) { @@ -301,7 +307,7 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg) 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; @@ -682,8 +688,7 @@ int server_disconnect_export(struct obd_export *exp) 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); @@ -1411,6 +1416,7 @@ static int target_exp_enqueue_req_replay(struct ptlrpc_request *req) __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); @@ -1419,6 +1425,7 @@ static int target_exp_enqueue_req_replay(struct ptlrpc_request *req) 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; } @@ -1430,6 +1437,16 @@ static int target_exp_enqueue_req_replay(struct ptlrpc_request *req) (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); @@ -2740,20 +2757,23 @@ int target_pack_pool_reply(struct ptlrpc_request *req) 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)