@@ -2234,9 +2234,16 @@ static inline void ptlrpc_req_drop_rs(struct ptlrpc_request *req)
{
if (!req->rq_reply_state)
return; /* shouldn't occur */
+
+ /* req_repmsg equals rq_reply_state->rs_msg,
+ * so set it to NULL before rq_reply_state is possibly freed
+ */
+ spin_lock(&req->rq_early_free_lock);
+ req->rq_repmsg = NULL;
+ spin_unlock(&req->rq_early_free_lock);
+
ptlrpc_rs_decref(req->rq_reply_state);
req->rq_reply_state = NULL;
- req->rq_repmsg = NULL;
}
static inline u32 lustre_request_magic(struct ptlrpc_request *req)
@@ -1136,6 +1136,7 @@ static int ptlrpc_at_send_early_reply(struct ptlrpc_request *req)
}
*reqcopy = *req;
+ spin_lock_init(&reqcopy->rq_early_free_lock);
reqcopy->rq_reply_state = NULL;
reqcopy->rq_rep_swab_mask = 0;
reqcopy->rq_pack_bulk = 0;