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
This commit is contained in:
parent
74540a3183
commit
dc15d94fd9
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user