/* remember where it came from */
srv_req->rq_reply_handle = req;
+ spin_lock(&peer->cli_lock);
list_add(&srv_req->rq_list, &peer->cli_obd->obd_req_list);
+ spin_unlock(&peer->cli_lock);
wake_up(&peer->cli_obd->obd_req_waitq);
return 0;
}
}
memset(request, 0, sizeof(*request));
+ //spin_lock_init(&request->rq_lock);
spin_lock(&cl->cli_lock);
request->rq_xid = cl->cli_xid++;
static int ptlrpc_check_reply(struct ptlrpc_request *req)
{
+ int rc = 0;
+
+ //spin_lock(&req->rq_lock);
if (req->rq_repbuf != NULL) {
req->rq_flags = PTL_RPC_REPLY;
EXIT;
- return 1;
+ rc = 1;
+ goto out;
}
if (sigismember(&(current->pending.signal), SIGKILL) ||
+ sigismember(&(current->pending.signal), SIGTERM) ||
+ sigismember(&(current->pending.signal), SIGSTOP) ||
sigismember(&(current->pending.signal), SIGINT)) {
req->rq_flags = PTL_RPC_INTR;
EXIT;
- return 1;
+ rc = 1;
+ goto out;
}
- return 0;
+ out:
+ //spin_unlock(&req->rq_lock);
+ return rc;
}
int ptlrpc_check_status(struct ptlrpc_request *req, int err)
/* Abort this request and cleanup any resources associated with it. */
int ptlrpc_abort(struct ptlrpc_request *request)
{
- /* First remove the MD for the reply; in theory, this means
+ /* First remove the ME for the reply; in theory, this means
* that we can tear down the buffer safely. */
+ //spin_lock(&request->rq_lock);
PtlMEUnlink(request->rq_reply_me_h);
- PtlMDUnlink(request->rq_reply_md_h);
OBD_FREE(request->rq_repbuf, request->rq_replen);
request->rq_repbuf = NULL;
request->rq_replen = 0;
+ //spin_unlock(&request->rq_lock);
return 0;
}
+
int ptlrpc_queue_wait(struct ptlrpc_client *cl, struct ptlrpc_request *req)
{
- int rc;
+ int rc = 0;
ENTRY;
init_waitqueue_head(&req->rq_wait_for_rep);
CDEBUG(D_OTHER, "-- sleeping\n");
wait_event_interruptible(req->rq_wait_for_rep, ptlrpc_check_reply(req));
CDEBUG(D_OTHER, "-- done\n");
-
+ //spin_lock(&req->rq_lock);
if (req->rq_flags == PTL_RPC_INTR) {
/* Clean up the dangling reply buffers */
ptlrpc_abort(req);
EXIT;
- return -EINTR;
+ rc = -EINTR;
+ goto out;
}
if (req->rq_flags != PTL_RPC_REPLY) {
CERROR("Unknown reason for wakeup\n");
- BUG();
+ /* XXX Phil - I end up here when I kill obdctl */
+ ptlrpc_abort(req);
+ //BUG();
EXIT;
- return -EINTR;
+ rc = -EINTR;
+ goto out;
}
rc = cl->cli_rep_unpack(req->rq_repbuf, req->rq_replen,
&req->rq_rephdr, &req->rq_rep);
if (rc) {
CERROR("unpack_rep failed: %d\n", rc);
- return rc;
+ goto out;
}
CDEBUG(D_NET, "got rep %d\n", req->rq_rephdr->xid);
req->rq_replen, req->rq_rephdr->status);
EXIT;
- return 0;
+ out:
+ //spin_unlock(&req->rq_lock);
+ return rc;
}