Skip to content

Commit

Permalink
SUNRPC: Clean up soft task error handling
Browse files Browse the repository at this point in the history
- Ensure that the task aborts the RPC call only when it has actually timed out.
 - Ensure that req->rq_majortimeo is initialised correctly.

Signed-off-by: Trond Myklebust <[email protected]>
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Sep 23, 2006
1 parent 7630399 commit da45828
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 27 deletions.
34 changes: 14 additions & 20 deletions net/sunrpc/clnt.c
Original file line number Diff line number Diff line change
Expand Up @@ -863,15 +863,11 @@ call_bind_status(struct rpc_task *task)
dprintk("RPC: %4d remote rpcbind: RPC program/version unavailable\n",
task->tk_pid);
rpc_delay(task, 3*HZ);
goto retry_bind;
goto retry_timeout;
case -ETIMEDOUT:
dprintk("RPC: %4d rpcbind request timed out\n",
task->tk_pid);
if (RPC_IS_SOFT(task)) {
status = -EIO;
break;
}
goto retry_bind;
goto retry_timeout;
case -EPFNOSUPPORT:
dprintk("RPC: %4d remote rpcbind service unavailable\n",
task->tk_pid);
Expand All @@ -884,16 +880,13 @@ call_bind_status(struct rpc_task *task)
dprintk("RPC: %4d unrecognized rpcbind error (%d)\n",
task->tk_pid, -task->tk_status);
status = -EIO;
break;
}

rpc_exit(task, status);
return;

retry_bind:
task->tk_status = 0;
task->tk_action = call_bind;
return;
retry_timeout:
task->tk_action = call_timeout;
}

/*
Expand Down Expand Up @@ -941,14 +934,16 @@ call_connect_status(struct rpc_task *task)

switch (status) {
case -ENOTCONN:
case -ETIMEDOUT:
case -EAGAIN:
task->tk_action = call_bind;
break;
default:
rpc_exit(task, -EIO);
break;
if (!RPC_IS_SOFT(task))
return;
/* if soft mounted, test if we've timed out */
case -ETIMEDOUT:
task->tk_action = call_timeout;
return;
}
rpc_exit(task, -EIO);
}

/*
Expand Down Expand Up @@ -1057,7 +1052,6 @@ call_status(struct rpc_task *task)
printk("%s: RPC call returned error %d\n",
clnt->cl_protname, -status);
rpc_exit(task, status);
break;
}
}

Expand Down Expand Up @@ -1125,10 +1119,10 @@ call_decode(struct rpc_task *task)
clnt->cl_stats->rpcretrans++;
goto out_retry;
}
printk(KERN_WARNING "%s: too small RPC reply size (%d bytes)\n",
dprintk("%s: too small RPC reply size (%d bytes)\n",
clnt->cl_protname, task->tk_status);
rpc_exit(task, -EIO);
return;
task->tk_action = call_timeout;
goto out_retry;
}

/*
Expand Down
8 changes: 1 addition & 7 deletions net/sunrpc/xprt.c
Original file line number Diff line number Diff line change
Expand Up @@ -585,13 +585,6 @@ static void xprt_connect_status(struct rpc_task *task)
task->tk_pid, -task->tk_status, task->tk_client->cl_server);
xprt_release_write(xprt, task);
task->tk_status = -EIO;
return;
}

/* if soft mounted, just cause this RPC to fail */
if (RPC_IS_SOFT(task)) {
xprt_release_write(xprt, task);
task->tk_status = -EIO;
}
}

Expand Down Expand Up @@ -829,6 +822,7 @@ static void xprt_request_init(struct rpc_task *task, struct rpc_xprt *xprt)
req->rq_bufsize = 0;
req->rq_xid = xprt_alloc_xid(xprt);
req->rq_release_snd_buf = NULL;
xprt_reset_majortimeo(req);
dprintk("RPC: %4d reserved req %p xid %08x\n", task->tk_pid,
req, ntohl(req->rq_xid));
}
Expand Down

0 comments on commit da45828

Please sign in to comment.