Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Feb 2013 21:58:07 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r247503 - in stable/8/sys: fs/nfs fs/nfsclient fs/nfsserver nfs nfsclient nfsserver
Message-ID:  <201302282158.r1SLw7cA064499@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Thu Feb 28 21:58:07 2013
New Revision: 247503
URL: http://svnweb.freebsd.org/changeset/base/247503

Log:
  MFC 245508,245566,245568,245611,245909:
  Various fixes to timestamps in NFS:
  - Use the VA_UTIMES_NULL flag to detect when NULL was passed to utimes()
    instead of comparing the desired time against the current time as a
    heuristic.
  - Remove unused nfs_curusec().
  - Use vfs_timestamp() to set file timestamps rather than invoking
    getmicrotime() or getnanotime() directly in NFS.
  - Use NFSD_MONOSEC (which maps to time_uptime) instead of the seconds
    portion of wall-time stamps to manage timeouts on events.
  - Remove unused nd_starttime from the per-request structure in the new
    NFS server.
  - Use nanotime() for the modification time on a delegation to get as
    precise a time as possible.
  - Use time_second instead of extracting the second from a call to
    getmicrotime().

Modified:
  stable/8/sys/fs/nfs/nfs.h
  stable/8/sys/fs/nfs/nfs_commonkrpc.c
  stable/8/sys/fs/nfs/nfs_commonsubs.c
  stable/8/sys/fs/nfs/nfsport.h
  stable/8/sys/fs/nfsclient/nfs_clport.c
  stable/8/sys/fs/nfsclient/nfs_clstate.c
  stable/8/sys/fs/nfsclient/nfs_clvnops.c
  stable/8/sys/fs/nfsserver/nfs_nfsdkrpc.c
  stable/8/sys/fs/nfsserver/nfs_nfsdport.c
  stable/8/sys/fs/nfsserver/nfs_nfsdstate.c
  stable/8/sys/nfs/nfs_common.c
  stable/8/sys/nfs/nfs_common.h
  stable/8/sys/nfsclient/nfs_krpc.c
  stable/8/sys/nfsclient/nfs_subs.c
  stable/8/sys/nfsclient/nfs_vnops.c
  stable/8/sys/nfsserver/nfs_srvsubs.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/fs/   (props changed)
  stable/8/sys/nfs/   (props changed)
  stable/8/sys/nfsclient/   (props changed)
  stable/8/sys/nfsserver/   (props changed)

Modified: stable/8/sys/fs/nfs/nfs.h
==============================================================================
--- stable/8/sys/fs/nfs/nfs.h	Thu Feb 28 21:57:38 2013	(r247502)
+++ stable/8/sys/fs/nfs/nfs.h	Thu Feb 28 21:58:07 2013	(r247503)
@@ -519,7 +519,6 @@ struct nfsrv_descript {
 	int			*nd_errp;	/* Pointer to ret status */
 	u_int32_t		nd_retxid;	/* Reply xid */
 	struct nfsrvcache	*nd_rp;		/* Assoc. cache entry */
-	struct timeval		nd_starttime;	/* Time RPC initiated */
 	fhandle_t		nd_fh;		/* File handle */
 	struct ucred		*nd_cred;	/* Credentials */
 	uid_t			nd_saveduid;	/* Saved uid */

Modified: stable/8/sys/fs/nfs/nfs_commonkrpc.c
==============================================================================
--- stable/8/sys/fs/nfs/nfs_commonkrpc.c	Thu Feb 28 21:57:38 2013	(r247502)
+++ stable/8/sys/fs/nfs/nfs_commonkrpc.c	Thu Feb 28 21:58:07 2013	(r247503)
@@ -413,18 +413,17 @@ nfs_feedback(int type, int proc, void *a
 {
 	struct nfs_feedback_arg *nf = (struct nfs_feedback_arg *) arg;
 	struct nfsmount *nmp = nf->nf_mount;
-	struct timeval now;
-
-	getmicrouptime(&now);
+	time_t now;
 
 	switch (type) {
 	case FEEDBACK_REXMIT2:
 	case FEEDBACK_RECONNECT:
-		if (nf->nf_lastmsg + nmp->nm_tprintf_delay < now.tv_sec) {
+		now = NFSD_MONOSEC;
+		if (nf->nf_lastmsg + nmp->nm_tprintf_delay < now) {
 			nfs_down(nmp, nf->nf_td,
 			    "not responding", 0, NFSSTA_TIMEO);
 			nf->nf_tprintfmsg = TRUE;
-			nf->nf_lastmsg = now.tv_sec;
+			nf->nf_lastmsg = now;
 		}
 		break;
 
@@ -454,7 +453,7 @@ newnfs_request(struct nfsrv_descript *nd
 	u_int16_t procnum;
 	u_int trylater_delay = 1;
 	struct nfs_feedback_arg nf;
-	struct timeval timo, now;
+	struct timeval timo;
 	AUTH *auth;
 	struct rpc_callextra ext;
 	enum clnt_stat stat;
@@ -570,8 +569,7 @@ newnfs_request(struct nfsrv_descript *nd
 		bzero(&nf, sizeof(struct nfs_feedback_arg));
 		nf.nf_mount = nmp;
 		nf.nf_td = td;
-		getmicrouptime(&now);
-		nf.nf_lastmsg = now.tv_sec -
+		nf.nf_lastmsg = NFSD_MONOSEC -
 		    ((nmp->nm_tprintf_delay)-(nmp->nm_tprintf_initial_delay));
 	}
 

Modified: stable/8/sys/fs/nfs/nfs_commonsubs.c
==============================================================================
--- stable/8/sys/fs/nfs/nfs_commonsubs.c	Thu Feb 28 21:57:38 2013	(r247502)
+++ stable/8/sys/fs/nfs/nfs_commonsubs.c	Thu Feb 28 21:58:07 2013	(r247503)
@@ -1979,7 +1979,6 @@ nfsv4_fillattr(struct nfsrv_descript *nd
 	struct statfs fs;
 	struct nfsfsinfo fsinf;
 	struct timespec temptime;
-	struct timeval curtime;
 	NFSACL_T *aclp, *naclp = NULL;
 #ifdef QUOTA
 	struct dqblk dqb;
@@ -2393,8 +2392,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd
 			retnum += NFSX_V4TIME;
 			break;
 		case NFSATTRBIT_TIMEACCESSSET:
-			NFSGETTIME(&curtime);
-			if (vap->va_atime.tv_sec != curtime.tv_sec) {
+			if ((vap->va_vaflags & VA_UTIMES_NULL) == 0) {
 				NFSM_BUILD(tl, u_int32_t *, NFSX_V4SETTIME);
 				*tl++ = txdr_unsigned(NFSV4SATTRTIME_TOCLIENT);
 				txdr_nfsv4time(&vap->va_atime, tl);
@@ -2423,8 +2421,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd
 			retnum += NFSX_V4TIME;
 			break;
 		case NFSATTRBIT_TIMEMODIFYSET:
-			NFSGETTIME(&curtime);
-			if (vap->va_mtime.tv_sec != curtime.tv_sec) {
+			if ((vap->va_vaflags & VA_UTIMES_NULL) == 0) {
 				NFSM_BUILD(tl, u_int32_t *, NFSX_V4SETTIME);
 				*tl++ = txdr_unsigned(NFSV4SATTRTIME_TOCLIENT);
 				txdr_nfsv4time(&vap->va_mtime, tl);

Modified: stable/8/sys/fs/nfs/nfsport.h
==============================================================================
--- stable/8/sys/fs/nfs/nfsport.h	Thu Feb 28 21:57:38 2013	(r247502)
+++ stable/8/sys/fs/nfs/nfsport.h	Thu Feb 28 21:58:07 2013	(r247503)
@@ -522,12 +522,6 @@ void nfsrvd_rcv(struct socket *, void *,
 #define	NCHNAMLEN	9999999
 
 /*
- * Define these to use the time of day clock.
- */
-#define	NFSGETTIME(t)		(getmicrotime(t))
-#define	NFSGETNANOTIME(t)	(getnanotime(t))
-
-/*
  * These macros are defined to initialize and set the timer routine.
  */
 #define	NFS_TIMERINIT \

Modified: stable/8/sys/fs/nfsclient/nfs_clport.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clport.c	Thu Feb 28 21:57:38 2013	(r247502)
+++ stable/8/sys/fs/nfsclient/nfs_clport.c	Thu Feb 28 21:58:07 2013	(r247503)
@@ -702,7 +702,6 @@ nfscl_fillsattr(struct nfsrv_descript *n
 	u_int32_t *tl;
 	struct nfsv2_sattr *sp;
 	nfsattrbit_t attrbits;
-	struct timeval curtime;
 
 	switch (nd->nd_flag & (ND_NFSV2 | ND_NFSV3 | ND_NFSV4)) {
 	case ND_NFSV2:
@@ -731,7 +730,6 @@ nfscl_fillsattr(struct nfsrv_descript *n
 		txdr_nfsv2time(&vap->va_mtime, &sp->sa_mtime);
 		break;
 	case ND_NFSV3:
-		getmicrotime(&curtime);
 		if (vap->va_mode != (mode_t)VNOVAL) {
 			NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
 			*tl++ = newnfs_true;
@@ -765,7 +763,7 @@ nfscl_fillsattr(struct nfsrv_descript *n
 			*tl = newnfs_false;
 		}
 		if (vap->va_atime.tv_sec != VNOVAL) {
-			if (vap->va_atime.tv_sec != curtime.tv_sec) {
+			if ((vap->va_vaflags & VA_UTIMES_NULL) == 0) {
 				NFSM_BUILD(tl, u_int32_t *, 3 * NFSX_UNSIGNED);
 				*tl++ = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT);
 				txdr_nfsv3time(&vap->va_atime, tl);
@@ -778,7 +776,7 @@ nfscl_fillsattr(struct nfsrv_descript *n
 			*tl = txdr_unsigned(NFSV3SATTRTIME_DONTCHANGE);
 		}
 		if (vap->va_mtime.tv_sec != VNOVAL) {
-			if (vap->va_mtime.tv_sec != curtime.tv_sec) {
+			if ((vap->va_vaflags & VA_UTIMES_NULL) == 0) {
 				NFSM_BUILD(tl, u_int32_t *, 3 * NFSX_UNSIGNED);
 				*tl++ = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT);
 				txdr_nfsv3time(&vap->va_mtime, tl);

Modified: stable/8/sys/fs/nfsclient/nfs_clstate.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clstate.c	Thu Feb 28 21:57:38 2013	(r247502)
+++ stable/8/sys/fs/nfsclient/nfs_clstate.c	Thu Feb 28 21:58:07 2013	(r247503)
@@ -2394,7 +2394,7 @@ nfscl_renewthread(struct nfsclclient *cl
 	u_int32_t clidrev;
 	int error, cbpathdown, islept, igotlock, ret, clearok;
 	uint32_t recover_done_time = 0;
-	struct timespec mytime;
+	time_t mytime;
 	static time_t prevsec = 0;
 	struct nfscllockownerfh *lfhp, *nlfhp;
 	struct nfscllockownerfhhead lfh;
@@ -2559,9 +2559,9 @@ tryagain:
 		 * Call nfscl_cleanupkext() once per second to check for
 		 * open/lock owners where the process has exited.
 		 */
-		NFSGETNANOTIME(&mytime);
-		if (prevsec != mytime.tv_sec) {
-			prevsec = mytime.tv_sec;
+		mytime = NFSD_MONOSEC;
+		if (prevsec != mytime) {
+			prevsec = mytime;
 			nfscl_cleanupkext(clp, &lfh);
 		}
 
@@ -4174,7 +4174,7 @@ nfscl_delegmodtime(vnode_t vp)
 	}
 	dp = nfscl_finddeleg(clp, np->n_fhp->nfh_fh, np->n_fhp->nfh_len);
 	if (dp != NULL && (dp->nfsdl_flags & NFSCLDL_WRITE)) {
-		NFSGETNANOTIME(&dp->nfsdl_modtime);
+		nanotime(&dp->nfsdl_modtime);
 		dp->nfsdl_flags |= NFSCLDL_MODTIMESET;
 	}
 	NFSUNLOCKCLSTATE();

Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clvnops.c	Thu Feb 28 21:57:38 2013	(r247502)
+++ stable/8/sys/fs/nfsclient/nfs_clvnops.c	Thu Feb 28 21:58:07 2013	(r247503)
@@ -3162,7 +3162,7 @@ nfsfifo_read(struct vop_read_args *ap)
 	 */
 	mtx_lock(&np->n_mtx);
 	np->n_flag |= NACC;
-	getnanotime(&np->n_atim);
+	vfs_timestamp(&np->n_atim);
 	mtx_unlock(&np->n_mtx);
 	error = fifo_specops.vop_read(ap);
 	return error;	
@@ -3181,7 +3181,7 @@ nfsfifo_write(struct vop_write_args *ap)
 	 */
 	mtx_lock(&np->n_mtx);
 	np->n_flag |= NUPD;
-	getnanotime(&np->n_mtim);
+	vfs_timestamp(&np->n_mtim);
 	mtx_unlock(&np->n_mtx);
 	return(fifo_specops.vop_write(ap));
 }
@@ -3201,7 +3201,7 @@ nfsfifo_close(struct vop_close_args *ap)
 
 	mtx_lock(&np->n_mtx);
 	if (np->n_flag & (NACC | NUPD)) {
-		getnanotime(&ts);
+		vfs_timestamp(&ts);
 		if (np->n_flag & NACC)
 			np->n_atim = ts;
 		if (np->n_flag & NUPD)

Modified: stable/8/sys/fs/nfsserver/nfs_nfsdkrpc.c
==============================================================================
--- stable/8/sys/fs/nfsserver/nfs_nfsdkrpc.c	Thu Feb 28 21:57:38 2013	(r247502)
+++ stable/8/sys/fs/nfsserver/nfs_nfsdkrpc.c	Thu Feb 28 21:58:07 2013	(r247503)
@@ -290,7 +290,6 @@ nfs_proc(struct nfsrv_descript *nd, u_in
 	} else {
 		isdgram = 1;
 	}
-	NFSGETTIME(&nd->nd_starttime);
 
 	/*
 	 * Two cases:

Modified: stable/8/sys/fs/nfsserver/nfs_nfsdport.c
==============================================================================
--- stable/8/sys/fs/nfsserver/nfs_nfsdport.c	Thu Feb 28 21:57:38 2013	(r247502)
+++ stable/8/sys/fs/nfsserver/nfs_nfsdport.c	Thu Feb 28 21:58:07 2013	(r247503)
@@ -1471,7 +1471,7 @@ nfsvno_updfilerev(struct vnode *vp, stru
 	struct vattr va;
 
 	VATTR_NULL(&va);
-	getnanotime(&va.va_mtime);
+	vfs_timestamp(&va.va_mtime);
 	(void) VOP_SETATTR(vp, &va, cred);
 	(void) nfsvno_getattr(vp, nvap, cred, p, 1);
 }
@@ -2244,7 +2244,6 @@ nfsrv_sattr(struct nfsrv_descript *nd, s
 {
 	u_int32_t *tl;
 	struct nfsv2_sattr *sp;
-	struct timeval curtime;
 	int error = 0, toclient = 0;
 
 	switch (nd->nd_flag & (ND_NFSV2 | ND_NFSV3 | ND_NFSV4)) {
@@ -2303,9 +2302,7 @@ nfsrv_sattr(struct nfsrv_descript *nd, s
 			toclient = 1;
 			break;
 		case NFSV3SATTRTIME_TOSERVER:
-			NFSGETTIME(&curtime);
-			nvap->na_atime.tv_sec = curtime.tv_sec;
-			nvap->na_atime.tv_nsec = curtime.tv_usec * 1000;
+			vfs_timestamp(&nvap->na_atime);
 			nvap->na_vaflags |= VA_UTIMES_NULL;
 			break;
 		};
@@ -2317,9 +2314,7 @@ nfsrv_sattr(struct nfsrv_descript *nd, s
 			nvap->na_vaflags &= ~VA_UTIMES_NULL;
 			break;
 		case NFSV3SATTRTIME_TOSERVER:
-			NFSGETTIME(&curtime);
-			nvap->na_mtime.tv_sec = curtime.tv_sec;
-			nvap->na_mtime.tv_nsec = curtime.tv_usec * 1000;
+			vfs_timestamp(&nvap->na_mtime);
 			if (!toclient)
 				nvap->na_vaflags |= VA_UTIMES_NULL;
 			break;
@@ -2349,7 +2344,6 @@ nfsv4_sattr(struct nfsrv_descript *nd, s
 	u_char *cp, namestr[NFSV4_SMALLSTR + 1];
 	uid_t uid;
 	gid_t gid;
-	struct timeval curtime;
 
 	error = nfsrv_getattrbits(nd, attrbitp, NULL, &retnotsup);
 	if (error)
@@ -2484,9 +2478,7 @@ nfsv4_sattr(struct nfsrv_descript *nd, s
 			    toclient = 1;
 			    attrsum += NFSX_V4TIME;
 			} else {
-			    NFSGETTIME(&curtime);
-			    nvap->na_atime.tv_sec = curtime.tv_sec;
-			    nvap->na_atime.tv_nsec = curtime.tv_usec * 1000;
+			    vfs_timestamp(&nvap->na_atime);
 			    nvap->na_vaflags |= VA_UTIMES_NULL;
 			}
 			break;
@@ -2511,9 +2503,7 @@ nfsv4_sattr(struct nfsrv_descript *nd, s
 			    nvap->na_vaflags &= ~VA_UTIMES_NULL;
 			    attrsum += NFSX_V4TIME;
 			} else {
-			    NFSGETTIME(&curtime);
-			    nvap->na_mtime.tv_sec = curtime.tv_sec;
-			    nvap->na_mtime.tv_nsec = curtime.tv_usec * 1000;
+			    vfs_timestamp(&nvap->na_mtime);
 			    if (!toclient)
 				nvap->na_vaflags |= VA_UTIMES_NULL;
 			}

Modified: stable/8/sys/fs/nfsserver/nfs_nfsdstate.c
==============================================================================
--- stable/8/sys/fs/nfsserver/nfs_nfsdstate.c	Thu Feb 28 21:57:38 2013	(r247502)
+++ stable/8/sys/fs/nfsserver/nfs_nfsdstate.c	Thu Feb 28 21:58:07 2013	(r247503)
@@ -3966,7 +3966,6 @@ nfsrv_setupstable(NFSPROC_T *p)
 	int error, i, tryagain;
 	off_t off = 0;
 	int aresid, len;
-	struct timeval curtime;
 
 	/*
 	 * If NFSNSF_UPDATEDONE is set, this is a restart of the nfsds without
@@ -3977,8 +3976,7 @@ nfsrv_setupstable(NFSPROC_T *p)
 	/*
 	 * Set Grace over just until the file reads successfully.
 	 */
-	NFSGETTIME(&curtime);
-	nfsrvboottime = curtime.tv_sec;
+	nfsrvboottime = time_second;
 	LIST_INIT(&sf->nsf_head);
 	sf->nsf_flags = (NFSNSF_GRACEOVER | NFSNSF_NEEDLOCK);
 	sf->nsf_eograce = NFSD_MONOSEC + NFSRV_LEASEDELTA;
@@ -4649,8 +4647,7 @@ out:
 APPLESTATIC void
 nfsd_recalldelegation(vnode_t vp, NFSPROC_T *p)
 {
-	struct timespec mytime;
-	int32_t starttime;
+	time_t starttime;
 	int error;
 
 	/*
@@ -4674,8 +4671,7 @@ nfsd_recalldelegation(vnode_t vp, NFSPRO
 	 * Now, call nfsrv_checkremove() in a loop while it returns
 	 * NFSERR_DELAY. Return upon any other error or when timed out.
 	 */
-	NFSGETNANOTIME(&mytime);
-	starttime = (u_int32_t)mytime.tv_sec;
+	starttime = NFSD_MONOSEC;
 	do {
 		if (NFSVOPLOCK(vp, LK_EXCLUSIVE) == 0) {
 			error = nfsrv_checkremove(vp, 0, p);
@@ -4683,11 +4679,7 @@ nfsd_recalldelegation(vnode_t vp, NFSPRO
 		} else
 			error = EPERM;
 		if (error == NFSERR_DELAY) {
-			NFSGETNANOTIME(&mytime);
-			if (((u_int32_t)mytime.tv_sec - starttime) >
-			    NFS_REMOVETIMEO &&
-			    ((u_int32_t)mytime.tv_sec - starttime) <
-			    100000)
+			if (NFSD_MONOSEC - starttime > NFS_REMOVETIMEO)
 				break;
 			/* Sleep for a short period of time */
 			(void) nfs_catnap(PZERO, 0, "nfsremove");
@@ -4948,9 +4940,7 @@ nfsrv_notsamecredname(struct nfsrv_descr
 static time_t
 nfsrv_leaseexpiry(void)
 {
-	struct timeval curtime;
 
-	NFSGETTIME(&curtime);
 	if (nfsrv_stablefirst.nsf_eograce > NFSD_MONOSEC)
 		return (NFSD_MONOSEC + 2 * (nfsrv_lease + NFSRV_LEASEDELTA));
 	return (NFSD_MONOSEC + nfsrv_lease + NFSRV_LEASEDELTA);

Modified: stable/8/sys/nfs/nfs_common.c
==============================================================================
--- stable/8/sys/nfs/nfs_common.c	Thu Feb 28 21:57:38 2013	(r247502)
+++ stable/8/sys/nfs/nfs_common.c	Thu Feb 28 21:58:07 2013	(r247503)
@@ -90,15 +90,6 @@ static int nfs_realign_count;
 SYSCTL_INT(_vfs_nfs_common, OID_AUTO, realign_count, CTLFLAG_RD,
     &nfs_realign_count, 0, "Number of mbuf realignments done");
 
-u_quad_t
-nfs_curusec(void)
-{
-	struct timeval tv;
-
-	getmicrotime(&tv);
-	return ((u_quad_t)tv.tv_sec * 1000000 + (u_quad_t)tv.tv_usec);
-}
-
 /*
  * copies mbuf chain to the uio scatter/gather list
  */

Modified: stable/8/sys/nfs/nfs_common.h
==============================================================================
--- stable/8/sys/nfs/nfs_common.h	Thu Feb 28 21:57:38 2013	(r247502)
+++ stable/8/sys/nfs/nfs_common.h	Thu Feb 28 21:58:07 2013	(r247503)
@@ -46,7 +46,6 @@ extern nfstype nfsv3_type[];
 #define	vtonfsv3_type(a)	txdr_unsigned(nfsv3_type[((int32_t)(a))])
 
 int	nfs_adv(struct mbuf **, caddr_t *, int, int);
-u_quad_t nfs_curusec(void);
 void	*nfsm_disct(struct mbuf **, caddr_t *, int, int, int);
 int	nfs_realign(struct mbuf **, int);
 

Modified: stable/8/sys/nfsclient/nfs_krpc.c
==============================================================================
--- stable/8/sys/nfsclient/nfs_krpc.c	Thu Feb 28 21:57:38 2013	(r247502)
+++ stable/8/sys/nfsclient/nfs_krpc.c	Thu Feb 28 21:58:07 2013	(r247503)
@@ -394,18 +394,17 @@ nfs_feedback(int type, int proc, void *a
 {
 	struct nfs_feedback_arg *nf = (struct nfs_feedback_arg *) arg;
 	struct nfsmount *nmp = nf->nf_mount;
-	struct timeval now;
-
-	getmicrouptime(&now);
+	time_t now;
 
 	switch (type) {
 	case FEEDBACK_REXMIT2:
 	case FEEDBACK_RECONNECT:
-		if (nf->nf_lastmsg + nmp->nm_tprintf_delay < now.tv_sec) {
+		now = time_uptime;
+		if (nf->nf_lastmsg + nmp->nm_tprintf_delay < now) {
 			nfs_down(nmp, nf->nf_td,
 			    "not responding", 0, NFSSTA_TIMEO);
 			nf->nf_tprintfmsg = TRUE;
-			nf->nf_lastmsg = now.tv_sec;
+			nf->nf_lastmsg = now;
 		}
 		break;
 
@@ -438,7 +437,6 @@ nfs_request(struct vnode *vp, struct mbu
 	time_t waituntil;
 	caddr_t dpos;
 	int error = 0, timeo;
-	struct timeval now;
 	AUTH *auth = NULL;
 	enum nfs_rto_timer_t timer;
 	struct nfs_feedback_arg nf;
@@ -455,8 +453,7 @@ nfs_request(struct vnode *vp, struct mbu
 	bzero(&nf, sizeof(struct nfs_feedback_arg));
 	nf.nf_mount = nmp;
 	nf.nf_td = td;
-	getmicrouptime(&now);
-	nf.nf_lastmsg = now.tv_sec -
+	nf.nf_lastmsg = time_uptime -
 	    ((nmp->nm_tprintf_delay) - (nmp->nm_tprintf_initial_delay));
 
 	/*

Modified: stable/8/sys/nfsclient/nfs_subs.c
==============================================================================
--- stable/8/sys/nfsclient/nfs_subs.c	Thu Feb 28 21:57:38 2013	(r247502)
+++ stable/8/sys/nfsclient/nfs_subs.c	Thu Feb 28 21:58:07 2013	(r247503)
@@ -1119,7 +1119,7 @@ nfsm_v3attrbuild_xx(struct vattr *va, in
 		*tl = nfs_false;
 	}
 	if (va->va_atime.tv_sec != VNOVAL) {
-		if (va->va_atime.tv_sec != time_second) {
+		if ((va->va_vaflags & VA_UTIMES_NULL) == 0) {
 			tl = nfsm_build_xx(3 * NFSX_UNSIGNED, mb, bpos);
 			*tl++ = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT);
 			txdr_nfsv3time(&va->va_atime, tl);
@@ -1132,7 +1132,7 @@ nfsm_v3attrbuild_xx(struct vattr *va, in
 		*tl = txdr_unsigned(NFSV3SATTRTIME_DONTCHANGE);
 	}
 	if (va->va_mtime.tv_sec != VNOVAL) {
-		if (va->va_mtime.tv_sec != time_second) {
+		if ((va->va_vaflags & VA_UTIMES_NULL) == 0) {
 			tl = nfsm_build_xx(3 * NFSX_UNSIGNED, mb, bpos);
 			*tl++ = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT);
 			txdr_nfsv3time(&va->va_mtime, tl);

Modified: stable/8/sys/nfsclient/nfs_vnops.c
==============================================================================
--- stable/8/sys/nfsclient/nfs_vnops.c	Thu Feb 28 21:57:38 2013	(r247502)
+++ stable/8/sys/nfsclient/nfs_vnops.c	Thu Feb 28 21:58:07 2013	(r247503)
@@ -3461,7 +3461,7 @@ nfsfifo_read(struct vop_read_args *ap)
 	 */
 	mtx_lock(&np->n_mtx);
 	np->n_flag |= NACC;
-	getnanotime(&np->n_atim);
+	vfs_timestamp(&np->n_atim);
 	mtx_unlock(&np->n_mtx);
 	error = fifo_specops.vop_read(ap);
 	return error;	
@@ -3480,7 +3480,7 @@ nfsfifo_write(struct vop_write_args *ap)
 	 */
 	mtx_lock(&np->n_mtx);
 	np->n_flag |= NUPD;
-	getnanotime(&np->n_mtim);
+	vfs_timestamp(&np->n_mtim);
 	mtx_unlock(&np->n_mtx);
 	return(fifo_specops.vop_write(ap));
 }
@@ -3500,7 +3500,7 @@ nfsfifo_close(struct vop_close_args *ap)
 
 	mtx_lock(&np->n_mtx);
 	if (np->n_flag & (NACC | NUPD)) {
-		getnanotime(&ts);
+		vfs_timestamp(&ts);
 		if (np->n_flag & NACC)
 			np->n_atim = ts;
 		if (np->n_flag & NUPD)

Modified: stable/8/sys/nfsserver/nfs_srvsubs.c
==============================================================================
--- stable/8/sys/nfsserver/nfs_srvsubs.c	Thu Feb 28 21:57:38 2013	(r247502)
+++ stable/8/sys/nfsserver/nfs_srvsubs.c	Thu Feb 28 21:58:07 2013	(r247503)
@@ -1430,7 +1430,7 @@ nfsm_srvsattr_xx(struct vattr *a, struct
 		toclient = 1;
 		break;
 	case NFSV3SATTRTIME_TOSERVER:
-		getnanotime(&(a)->va_atime);
+		vfs_timestamp(&a->va_atime);
 		a->va_vaflags |= VA_UTIMES_NULL;
 		break;
 	}
@@ -1446,7 +1446,7 @@ nfsm_srvsattr_xx(struct vattr *a, struct
 		a->va_vaflags &= ~VA_UTIMES_NULL;
 		break;
 	case NFSV3SATTRTIME_TOSERVER:
-		getnanotime(&(a)->va_mtime);
+		vfs_timestamp(&a->va_mtime);
 		if (toclient == 0)
 			a->va_vaflags |= VA_UTIMES_NULL;
 		break;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201302282158.r1SLw7cA064499>