/* This is a request that came from the network via portals. */
/* FIXME: we need to increment the count of handled events */
- ptl_send_buf(req, &req->rq_peer, OST_REPLY_PORTAL, 0);
+ req->rq_type = PTLRPC_REPLY;
+ ptl_send_buf(req, &req->rq_peer, OST_REPLY_PORTAL);
} else {
/* This is a local request that came from another thread. */
/* FIXME: Serious refactoring needed */
int ost_main(void *arg)
{
+ int signal;
struct obd_device *obddev = (struct obd_device *) arg;
struct ost_obd *ost = &obddev->u.ost;
DECLARE_WAITQUEUE(wait, current);
while (1) {
int rc;
- if (ost->ost_flags & OST_EXIT)
- break;
-
if (ost->ost_service != NULL) {
ptl_event_t ev;
struct ptlrpc_request request;
struct ptlrpc_service *service;
CDEBUG(D_IOCTL, "-- sleeping\n");
+ signal = 0;
add_wait_queue(&ost->ost_waitq, &wait);
while (1) {
+ set_current_state(TASK_INTERRUPTIBLE);
rc = PtlEQGet(ost->ost_service->srv_eq_h, &ev);
if (rc == PTL_OK || rc == PTL_EQ_DROPPED)
break;
+ if (ost->ost_flags & OST_EXIT)
+ break;
- set_current_state(TASK_INTERRUPTIBLE);
/* if this process really wants to die,
* let it go */
if (sigismember(&(current->pending.signal),
SIGKILL) ||
sigismember(&(current->pending.signal),
- SIGINT))
+ SIGINT)) {
+ signal = 1;
break;
+ }
schedule();
}
set_current_state(TASK_RUNNING);
CDEBUG(D_IOCTL, "-- done\n");
- if (rc == PTL_EQ_EMPTY) {
+ if (signal == 1) {
/* We broke out because of a signal */
EXIT;
- return -EINTR;
+ break;
+ }
+ if (ost->ost_flags & OST_EXIT) {
+ EXIT;
+ break;
}
service = (struct ptlrpc_service *)ev.mem_desc.user_ptr;
if (list_empty(&ost->ost_reqs)) {
CDEBUG(D_INODE, "woke because of signal\n");
- spin_unlock(&ost->ost_req_lock);
+ spin_unlock(&ost->ost_lock);
} else {
request = list_entry(ost->ost_reqs.next,
struct ptlrpc_request,
rq_list);
list_del(&request->rq_list);
- spin_unlock(&ost->ost_req_lock);
+ spin_unlock(&ost->ost_lock);
rc = ost_handle(obddev, request);
}
}