svn commit: r291936 - head/sys/ufs/ufs

Konstantin Belousov kib at FreeBSD.org
Mon Dec 7 12:09:05 UTC 2015


Author: kib
Date: Mon Dec  7 12:09:04 2015
New Revision: 291936
URL: https://svnweb.freebsd.org/changeset/base/291936

Log:
  Update ctime when atime or birthtime are updated.
  
  Cleanup setting of ctime/mtime/birthtime: do not set IN_ACCESS or
  IN_UPDATE, then clear them with ufs_itimes(), making transient
  (possibly inconsistent) change to the times, and then copy
  user-supplied times into the inode.  Instead, directly clear IN_ACCESS
  or IN_UPDATE when user supplied the time, and copy the value into the
  inode.
  
  Minor inconsistency left is that the inode ctime is updated even when
  birthtime update attempt is performed on a UFS1 volume.
  
  Submitted by:	bde
  MFC after:	2 weeks

Modified:
  head/sys/ufs/ufs/ufs_vnops.c

Modified: head/sys/ufs/ufs/ufs_vnops.c
==============================================================================
--- head/sys/ufs/ufs/ufs_vnops.c	Mon Dec  7 11:21:49 2015	(r291935)
+++ head/sys/ufs/ufs/ufs_vnops.c	Mon Dec  7 12:09:04 2015	(r291936)
@@ -639,19 +639,14 @@ ufs_setattr(ap)
 		error = vn_utimes_perm(vp, vap, cred, td);
 		if (error != 0)
 			return (error);
-		if (vap->va_atime.tv_sec != VNOVAL)
-			ip->i_flag |= IN_ACCESS;
-		if (vap->va_mtime.tv_sec != VNOVAL)
-			ip->i_flag |= IN_CHANGE | IN_UPDATE;
-		if (vap->va_birthtime.tv_sec != VNOVAL &&
-		    ip->i_ump->um_fstype == UFS2)
-			ip->i_flag |= IN_MODIFIED;
-		ufs_itimes(vp);
+		ip->i_flag |= IN_CHANGE | IN_MODIFIED;
 		if (vap->va_atime.tv_sec != VNOVAL) {
+			ip->i_flag &= ~IN_ACCESS;
 			DIP_SET(ip, i_atime, vap->va_atime.tv_sec);
 			DIP_SET(ip, i_atimensec, vap->va_atime.tv_nsec);
 		}
 		if (vap->va_mtime.tv_sec != VNOVAL) {
+			ip->i_flag &= ~IN_UPDATE;
 			DIP_SET(ip, i_mtime, vap->va_mtime.tv_sec);
 			DIP_SET(ip, i_mtimensec, vap->va_mtime.tv_nsec);
 		}


More information about the svn-src-all mailing list