Update the event-loop for sync NFS commands to handle timeouts better.

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>
libnfs-4.0.0-vitalif
Ronnie Sahlberg 2017-05-31 21:23:03 -07:00
parent b7fd060bc6
commit 128ac2f725
1 changed files with 1 additions and 4 deletions

View File

@ -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;
}