Skip to content

Commit

Permalink
Update the event-loop for sync NFS commands to handle timeouts better.
Browse files Browse the repository at this point in the history
Change the loop so poll will timeout after 100ms so that we get 100ms
granularity on the timer that drives the timeouts.

Secondly, stop treating poll returning 0 as an error as this will be normal
if an application use sync NOF commands set to >>100ms for the timeout.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
  • Loading branch information
sahlberg committed Jun 1, 2017
1 parent b7fd060 commit 128ac2f
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions lib/libnfs-sync.c
Expand Up @@ -120,13 +120,10 @@ static void wait_for_reply(struct rpc_context *rpc, struct sync_cb_data *cb_data
pfd.fd = rpc_get_fd(rpc);
pfd.events = rpc_which_events(rpc);

ret = poll(&pfd, 1, rpc_get_timeout(rpc));
ret = poll(&pfd, 1, 100);
if (ret < 0) {
rpc_set_error(rpc, "Poll failed");
revents = -1;
} else if(ret == 0) {
rpc_set_error(rpc, "Timed out after [%d] milliseconds",rpc_get_timeout(rpc));
revents = -1;
} else {
revents = pfd.revents;
}
Expand Down

0 comments on commit 128ac2f

Please sign in to comment.