diff options
Diffstat (limited to 'fs/inode.c')
-rw-r--r-- | fs/inode.c | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/fs/inode.c b/fs/inode.c index 53245ffcf93d..6f6250c08ce6 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -1199,42 +1199,37 @@ void touch_atime(struct vfsmount *mnt, struct dentry *dentry) | |||
1199 | struct inode *inode = dentry->d_inode; | 1199 | struct inode *inode = dentry->d_inode; |
1200 | struct timespec now; | 1200 | struct timespec now; |
1201 | 1201 | ||
1202 | if (inode->i_flags & S_NOATIME) | 1202 | if (mnt_want_write(mnt)) |
1203 | return; | 1203 | return; |
1204 | if (inode->i_flags & S_NOATIME) | ||
1205 | goto out; | ||
1204 | if (IS_NOATIME(inode)) | 1206 | if (IS_NOATIME(inode)) |
1205 | return; | 1207 | goto out; |
1206 | if ((inode->i_sb->s_flags & MS_NODIRATIME) && S_ISDIR(inode->i_mode)) | 1208 | if ((inode->i_sb->s_flags & MS_NODIRATIME) && S_ISDIR(inode->i_mode)) |
1207 | return; | 1209 | goto out; |
1208 | |||
1209 | /* | ||
1210 | * We may have a NULL vfsmount when coming from NFSD | ||
1211 | */ | ||
1212 | if (mnt) { | ||
1213 | if (mnt->mnt_flags & MNT_NOATIME) | ||
1214 | return; | ||
1215 | if ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode)) | ||
1216 | return; | ||
1217 | 1210 | ||
1218 | if (mnt->mnt_flags & MNT_RELATIME) { | 1211 | if (mnt->mnt_flags & MNT_NOATIME) |
1219 | /* | 1212 | goto out; |
1220 | * With relative atime, only update atime if the | 1213 | if ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode)) |
1221 | * previous atime is earlier than either the ctime or | 1214 | goto out; |
1222 | * mtime. | 1215 | if (mnt->mnt_flags & MNT_RELATIME) { |
1223 | */ | 1216 | /* |
1224 | if (timespec_compare(&inode->i_mtime, | 1217 | * With relative atime, only update atime if the previous |
1225 | &inode->i_atime) < 0 && | 1218 | * atime is earlier than either the ctime or mtime. |
1226 | timespec_compare(&inode->i_ctime, | 1219 | */ |
1227 | &inode->i_atime) < 0) | 1220 | if (timespec_compare(&inode->i_mtime, &inode->i_atime) < 0 && |
1228 | return; | 1221 | timespec_compare(&inode->i_ctime, &inode->i_atime) < 0) |
1229 | } | 1222 | goto out; |
1230 | } | 1223 | } |
1231 | 1224 | ||
1232 | now = current_fs_time(inode->i_sb); | 1225 | now = current_fs_time(inode->i_sb); |
1233 | if (timespec_equal(&inode->i_atime, &now)) | 1226 | if (timespec_equal(&inode->i_atime, &now)) |
1234 | return; | 1227 | goto out; |
1235 | 1228 | ||
1236 | inode->i_atime = now; | 1229 | inode->i_atime = now; |
1237 | mark_inode_dirty_sync(inode); | 1230 | mark_inode_dirty_sync(inode); |
1231 | out: | ||
1232 | mnt_drop_write(mnt); | ||
1238 | } | 1233 | } |
1239 | EXPORT_SYMBOL(touch_atime); | 1234 | EXPORT_SYMBOL(touch_atime); |
1240 | 1235 | ||