提交 cdb70f3f 编写于 作者: D Dave Hansen 提交者: Al Viro

[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: NAl Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NDave Hansen <haveblue@us.ibm.com>
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 a761a1c0
...@@ -1199,42 +1199,37 @@ void touch_atime(struct vfsmount *mnt, struct dentry *dentry) ...@@ -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 (inode->i_flags & S_NOATIME) if (mnt_want_write(mnt))
return; return;
if (inode->i_flags & S_NOATIME)
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;
/*
* We may have a NULL vfsmount when coming from NFSD
*/
if (mnt) {
if (mnt->mnt_flags & MNT_NOATIME)
return;
if ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode))
return;
if (mnt->mnt_flags & MNT_RELATIME) { if (mnt->mnt_flags & MNT_NOATIME)
/* goto out;
* With relative atime, only update atime if the if ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode))
* previous atime is earlier than either the ctime or goto out;
* mtime. if (mnt->mnt_flags & MNT_RELATIME) {
*/ /*
if (timespec_compare(&inode->i_mtime, * With relative atime, only update atime if the previous
&inode->i_atime) < 0 && * atime is earlier than either the ctime or mtime.
timespec_compare(&inode->i_ctime, */
&inode->i_atime) < 0) if (timespec_compare(&inode->i_mtime, &inode->i_atime) < 0 &&
return; timespec_compare(&inode->i_ctime, &inode->i_atime) < 0)
} goto out;
} }
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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册