*/
/*
* This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
*/
/** Implementation of client-side PortalRPC interfaces */
* resent time, but server sent back service time of original
* RPC.
*/
- CDEBUG((lustre_msg_get_flags(req->rq_reqmsg) & MSG_RESENT) ?
- D_ADAPTTO : D_WARNING,
- "Reported service time %u > total measured time %lld\n",
- service_timeout, now - req->rq_sent);
+ CDEBUG_LIMIT((lustre_msg_get_flags(req->rq_reqmsg) &
+ MSG_RESENT) ? D_ADAPTTO : D_WARNING,
+ "Reported service time %u > total measured time %lld\n",
+ service_timeout, now - req->rq_sent);
return;
}
return NULL;
}
- request = list_entry(pool->prp_req_list.next, struct ptlrpc_request,
- rq_list);
+ request = list_first_entry(&pool->prp_req_list, struct ptlrpc_request,
+ rq_list);
list_del_init(&request->rq_list);
spin_unlock(&pool->prp_lock);
if (list_empty(&imp->imp_unreplied_list))
return 0;
- req = list_entry(imp->imp_unreplied_list.next, struct ptlrpc_request,
- rq_unreplied_list);
+ req = list_first_entry(&imp->imp_unreplied_list, struct ptlrpc_request,
+ rq_unreplied_list);
LASSERTF(req->rq_xid >= 1, "XID:%llu\n", req->rq_xid);
if (imp->imp_known_replied_xid < req->rq_xid - 1)
lustre_msg_set_status(req->rq_reqmsg, current->pid);
- rc = sptlrpc_req_refresh_ctx(req, 0);
+ /* If the request to be sent is an LDLM callback, do not try to
+ * refresh context.
+ * An LDLM callback is sent by a server to a client in order to make
+ * it release a lock, on a communication channel that uses a reverse
+ * context. It cannot be refreshed on its own, as it is the 'reverse'
+ * (server-side) representation of a client context.
+ * We do not care if the reverse context is expired, and want to send
+ * the LDLM callback anyway. Once the client receives the AST, it is
+ * its job to refresh its own context if it has expired, hence
+ * refreshing the associated reverse context on server side, before
+ * being able to send the LDLM_CANCEL requested by the server.
+ */
+ if (lustre_msg_get_opc(req->rq_reqmsg) != LDLM_BL_CALLBACK &&
+ lustre_msg_get_opc(req->rq_reqmsg) != LDLM_CP_CALLBACK &&
+ lustre_msg_get_opc(req->rq_reqmsg) != LDLM_GL_CALLBACK)
+ rc = sptlrpc_req_refresh_ctx(req, 0);
if (rc) {
if (req->rq_err) {
req->rq_status = rc;
* was good after getting the REPLY for her GET or
* the ACK for her PUT.
*/
- DEBUG_REQ(D_ERROR, req, "bulk transfer failed");
+ DEBUG_REQ(D_ERROR, req, "bulk transfer failed %d/%d/%d",
+ req->rq_status,
+ req->rq_bulk->bd_nob,
+ req->rq_bulk->bd_nob_transferred);
req->rq_status = -EIO;
}
* request to ensure previous bulk fails and avoid problems with lost replies
* and therefore several transfers landing into the same buffer from different
* sending attempts.
+ * Also, to avoid previous reply landing to a different sending attempt.
*/
-void ptlrpc_set_bulk_mbits(struct ptlrpc_request *req)
+void ptlrpc_set_mbits(struct ptlrpc_request *req)
{
- struct ptlrpc_bulk_desc *bd = req->rq_bulk;
-
- LASSERT(bd != NULL);
+ int md_count = req->rq_bulk ? req->rq_bulk->bd_md_count : 1;
/*
* Generate new matchbits for all resend requests, including
* 'resend for the -EINPROGRESS resend'. To make it simple,
* we opt to generate mbits for all resend cases.
*/
- if (OCD_HAS_FLAG(&bd->bd_import->imp_connect_data,
+ if (OCD_HAS_FLAG(&req->rq_import->imp_connect_data,
BULK_MBITS)) {
req->rq_mbits = ptlrpc_next_xid();
} else {
spin_unlock(&req->rq_import->imp_lock);
req->rq_mbits = req->rq_xid;
}
- CDEBUG(D_HA, "resend bulk old x%llu new x%llu\n",
+ CDEBUG(D_HA, "resend with new mbits old x%llu new x%llu\n",
old_mbits, req->rq_mbits);
} else if (!(lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY)) {
/* Request being sent first time, use xid as matchbits. */
- if (OCD_HAS_FLAG(&bd->bd_import->imp_connect_data, BULK_MBITS)
- || req->rq_mbits == 0) {
+ if (OCD_HAS_FLAG(&req->rq_import->imp_connect_data,
+ BULK_MBITS) || req->rq_mbits == 0)
+ {
req->rq_mbits = req->rq_xid;
} else {
- req->rq_mbits -= bd->bd_md_count - 1;
+ req->rq_mbits -= md_count - 1;
}
} else {
/*
* that server can infer the number of bulks that were prepared,
* see LU-1431
*/
- req->rq_mbits += bd->bd_md_count - 1;
+ req->rq_mbits += md_count - 1;
/*
* Set rq_xid as rq_mbits to indicate the final bulk for the old
* It's ok to directly set the rq_xid here, since this xid bump
* won't affect the request position in unreplied list.
*/
- if (!OCD_HAS_FLAG(&bd->bd_import->imp_connect_data, BULK_MBITS))
+ if (!OCD_HAS_FLAG(&req->rq_import->imp_connect_data, BULK_MBITS))
req->rq_xid = req->rq_mbits;
}