* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2012, 2014, Intel Corporation.
+ * Copyright (c) 2012, 2015, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
lustre_msghdr_set_flags(request->rq_reqmsg,
imp->imp_msghdr_flags);
- if (request->rq_nr_resend != 0) {
+ /* If it's the first time to resend the request for EINPROGRESS,
+ * we need to allocate a new XID (see after_reply()), it's different
+ * from the resend for reply timeout. */
+ if (request->rq_nr_resend != 0 &&
+ list_empty(&request->rq_unreplied_list)) {
+ __u64 min_xid = 0;
/* resend for EINPROGRESS, allocate new xid to avoid reply
* reconstruction */
- request->rq_xid = ptlrpc_next_xid();
+ spin_lock(&imp->imp_lock);
+ ptlrpc_assign_next_xid_nolock(request);
+ min_xid = ptlrpc_known_replied_xid(imp);
+ spin_unlock(&imp->imp_lock);
+
+ lustre_msg_set_last_xid(request->rq_reqmsg, min_xid);
DEBUG_REQ(D_RPCTRACE, request, "Allocating new xid for "
"resend on EINPROGRESS");
}
lustre_msg_set_mbits(request->rq_reqmsg, request->rq_mbits);
}
+ if (list_empty(&request->rq_unreplied_list) ||
+ request->rq_xid <= imp->imp_known_replied_xid) {
+ DEBUG_REQ(D_ERROR, request, "xid: "LPU64", replied: "LPU64", "
+ "list_empty:%d\n", request->rq_xid,
+ imp->imp_known_replied_xid,
+ list_empty(&request->rq_unreplied_list));
+ LBUG();
+ }
+
/** For enabled AT all request should have AT_SUPPORT in the
* FULL import state when OBD_CONNECT_AT is set */
LASSERT(AT_OFF || imp->imp_state != LUSTRE_IMP_FULL ||
if (request->rq_memalloc)
mpflag = cfs_memory_pressure_get_and_set();
- rc = sptlrpc_cli_wrap_request(request);
- if (rc)
- GOTO(out, rc);
+ rc = sptlrpc_cli_wrap_request(request);
+ if (rc == -ENOMEM)
+ /* set rq_sent so that this request is treated
+ * as a delayed send in the upper layers */
+ request->rq_sent = cfs_time_current_sec();
+ if (rc)
+ GOTO(out, rc);
/* bulk register should be done after wrap_request() */
if (request->rq_bulk != NULL) {