diff options
author | Bret Lambert <blambert@cvs.openbsd.org> | 2009-07-22 13:04:57 +0000 |
---|---|---|
committer | Bret Lambert <blambert@cvs.openbsd.org> | 2009-07-22 13:04:57 +0000 |
commit | b854200df909f0d9319e52042a745db5aaaea3f6 (patch) | |
tree | 6a326a6972fbba2ddae97d80308f83b6be3df063 | |
parent | c2ef7ca37d2b2d3339dfbb3dd0fac584f55cea31 (diff) |
Instead of calculating a number of seconds to sleep, tsleep()ing on
lbolt and waking up every second and checking to see if the correct
number of seconds has passed, just calculate the timeout once and
pass that to tsleep().
ok thib@
-rw-r--r-- | sys/nfs/nfs_socket.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/sys/nfs/nfs_socket.c b/sys/nfs/nfs_socket.c index 6d151c0479d..b43ff3d575e 100644 --- a/sys/nfs/nfs_socket.c +++ b/sys/nfs/nfs_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_socket.c,v 1.90 2009/07/20 16:49:40 thib Exp $ */ +/* $OpenBSD: nfs_socket.c,v 1.91 2009/07/22 13:04:56 blambert Exp $ */ /* $NetBSD: nfs_socket.c,v 1.27 1996/04/15 20:20:00 thorpej Exp $ */ /* @@ -896,7 +896,7 @@ nfs_request1(struct nfsreq *rep, struct ucred *cred, struct mbuf **mrp, u_int32_t *tl; struct nfsmount *nmp; struct mbuf *md; - time_t waituntil; + struct timeval tv; caddr_t dpos, cp2; int t1, i, s, error = 0; int trylater_delay; @@ -1026,13 +1026,12 @@ tryagain: if (*tl != 0) { error = fxdr_unsigned(int, *tl); if ((nmp->nm_flag & NFSMNT_NFSV3) && - error == NFSERR_TRYLATER) { + error == NFSERR_TRYLATER) { m_freem(mrep); error = 0; - waituntil = time_second + trylater_delay; - while (time_second < waituntil) - (void) tsleep((caddr_t)&lbolt, - PSOCK, "nqnfstry", 0); + tv.tv_sec = time_second + trylater_delay; + tv.tv_usec = 0; + tsleep(&tv, PSOCK, "nfsretry", hzto(&tv)); trylater_delay *= NFS_TIMEOUTMUL; if (trylater_delay > NFS_MAXTIMEO) trylater_delay = NFS_MAXTIMEO; |