aboutsummaryrefslogtreecommitdiffstats
path: root/fs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/inode.c')
-rw-r--r--fs/inode.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/fs/inode.c b/fs/inode.c
index 04536ebc5ac4..bf21dc6d0dbd 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1177,13 +1177,27 @@ void touch_atime(struct vfsmount *mnt, struct dentry *dentry)
1177 return; 1177 return;
1178 if ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode)) 1178 if ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode))
1179 return; 1179 return;
1180
1181 if (mnt->mnt_flags & MNT_RELATIME) {
1182 /*
1183 * With relative atime, only update atime if the
1184 * previous atime is earlier than either the ctime or
1185 * mtime.
1186 */
1187 if (timespec_compare(&inode->i_mtime,
1188 &inode->i_atime) < 0 &&
1189 timespec_compare(&inode->i_ctime,
1190 &inode->i_atime) < 0)
1191 return;
1192 }
1180 } 1193 }
1181 1194
1182 now = current_fs_time(inode->i_sb); 1195 now = current_fs_time(inode->i_sb);
1183 if (!timespec_equal(&inode->i_atime, &now)) { 1196 if (timespec_equal(&inode->i_atime, &now))
1184 inode->i_atime = now; 1197 return;
1185 mark_inode_dirty_sync(inode); 1198
1186 } 1199 inode->i_atime = now;
1200 mark_inode_dirty_sync(inode);
1187} 1201}
1188EXPORT_SYMBOL(touch_atime); 1202EXPORT_SYMBOL(touch_atime);
1189 1203