- ptlrpc_set_add_new_req(pc->pc_set, req);
- req->rq_ptlrpcd_data = pc;
-
- ptlrpcd_wake(req);
+ rc = ptlrpc_set_add_new_req(pc, req);
+ if (rc) {
+ int (*interpreter)(struct ptlrpc_request *,
+ void *, int);
+
+ interpreter = req->rq_interpret_reply;
+
+ /*
+ * Thread is probably in stop now so we need to
+ * kill this rpc as it was not added. Let's call
+ * interpret for it to let know we're killing it
+ * so that higher levels might free assosiated
+ * resources.
+ */
+ req->rq_status = -EBADR;
+ interpreter(req, &req->rq_async_args,
+ req->rq_status);
+ req->rq_set = NULL;
+ ptlrpc_req_finished(req);
+ }