mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-11-01 02:21:16 +00:00
[PATCH] r/o bind mounts: write counts for touch_atime()
Remove handling of NULL mnt while we are at it - that can't happen these days. Acked-by: Al Viro <viro@ZenIV.linux.org.uk> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Hansen <haveblue@us.ibm.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
a761a1c03a
commit
cdb70f3f74
1 changed files with 20 additions and 25 deletions
45
fs/inode.c
45
fs/inode.c
|
@ -1199,42 +1199,37 @@ void touch_atime(struct vfsmount *mnt, struct dentry *dentry)
|
||||||
struct inode *inode = dentry->d_inode;
|
struct inode *inode = dentry->d_inode;
|
||||||
struct timespec now;
|
struct timespec now;
|
||||||
|
|
||||||
|
if (mnt_want_write(mnt))
|
||||||
|
return;
|
||||||
if (inode->i_flags & S_NOATIME)
|
if (inode->i_flags & S_NOATIME)
|
||||||
return;
|
goto out;
|
||||||
if (IS_NOATIME(inode))
|
if (IS_NOATIME(inode))
|
||||||
return;
|
goto out;
|
||||||
if ((inode->i_sb->s_flags & MS_NODIRATIME) && S_ISDIR(inode->i_mode))
|
if ((inode->i_sb->s_flags & MS_NODIRATIME) && S_ISDIR(inode->i_mode))
|
||||||
return;
|
goto out;
|
||||||
|
|
||||||
/*
|
if (mnt->mnt_flags & MNT_NOATIME)
|
||||||
* We may have a NULL vfsmount when coming from NFSD
|
goto out;
|
||||||
*/
|
if ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode))
|
||||||
if (mnt) {
|
goto out;
|
||||||
if (mnt->mnt_flags & MNT_NOATIME)
|
if (mnt->mnt_flags & MNT_RELATIME) {
|
||||||
return;
|
/*
|
||||||
if ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode))
|
* With relative atime, only update atime if the previous
|
||||||
return;
|
* atime is earlier than either the ctime or mtime.
|
||||||
|
*/
|
||||||
if (mnt->mnt_flags & MNT_RELATIME) {
|
if (timespec_compare(&inode->i_mtime, &inode->i_atime) < 0 &&
|
||||||
/*
|
timespec_compare(&inode->i_ctime, &inode->i_atime) < 0)
|
||||||
* With relative atime, only update atime if the
|
goto out;
|
||||||
* previous atime is earlier than either the ctime or
|
|
||||||
* mtime.
|
|
||||||
*/
|
|
||||||
if (timespec_compare(&inode->i_mtime,
|
|
||||||
&inode->i_atime) < 0 &&
|
|
||||||
timespec_compare(&inode->i_ctime,
|
|
||||||
&inode->i_atime) < 0)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
now = current_fs_time(inode->i_sb);
|
now = current_fs_time(inode->i_sb);
|
||||||
if (timespec_equal(&inode->i_atime, &now))
|
if (timespec_equal(&inode->i_atime, &now))
|
||||||
return;
|
goto out;
|
||||||
|
|
||||||
inode->i_atime = now;
|
inode->i_atime = now;
|
||||||
mark_inode_dirty_sync(inode);
|
mark_inode_dirty_sync(inode);
|
||||||
|
out:
|
||||||
|
mnt_drop_write(mnt);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(touch_atime);
|
EXPORT_SYMBOL(touch_atime);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue