svn commit: r245508 - in head/sys: fs/nfs fs/nfsclient nfsclient

John Baldwin jhb at FreeBSD.org
Wed Jan 16 21:52:32 UTC 2013


Author: jhb
Date: Wed Jan 16 21:52:31 2013
New Revision: 245508
URL: http://svnweb.freebsd.org/changeset/base/245508

Log:
  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.
  
  Reviewed by:	rmacklem
  MFC after:	1 week

Modified:
  head/sys/fs/nfs/nfs_commonsubs.c
  head/sys/fs/nfsclient/nfs_clport.c
  head/sys/nfsclient/nfs_subs.c

Modified: head/sys/fs/nfs/nfs_commonsubs.c
==============================================================================
--- head/sys/fs/nfs/nfs_commonsubs.c	Wed Jan 16 19:05:49 2013	(r245507)
+++ head/sys/fs/nfs/nfs_commonsubs.c	Wed Jan 16 21:52:31 2013	(r245508)
@@ -1998,7 +1998,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;
@@ -2412,8 +2411,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);
@@ -2442,8 +2440,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: head/sys/fs/nfsclient/nfs_clport.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clport.c	Wed Jan 16 19:05:49 2013	(r245507)
+++ head/sys/fs/nfsclient/nfs_clport.c	Wed Jan 16 21:52:31 2013	(r245508)
@@ -789,7 +789,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);
@@ -802,7 +802,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: head/sys/nfsclient/nfs_subs.c
==============================================================================
--- head/sys/nfsclient/nfs_subs.c	Wed Jan 16 19:05:49 2013	(r245507)
+++ head/sys/nfsclient/nfs_subs.c	Wed Jan 16 21:52:31 2013	(r245508)
@@ -1110,7 +1110,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);
@@ -1123,7 +1123,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);


More information about the svn-src-all mailing list