diff options
author | Dave Hansen <haveblue@us.ibm.com> | 2008-02-15 23:37:41 +0100 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2008-04-19 06:29:23 +0200 |
commit | cdb70f3f74b31576cc4d707a3d3b00d159cab8bb (patch) | |
tree | 6b2fd4e67c78811c29632c30854af29849c2594f | |
parent | [PATCH] r/o bind mounts: elevate write count for ncp_ioctl() (diff) | |
download | linux-cdb70f3f74b31576cc4d707a3d3b00d159cab8bb.tar.xz linux-cdb70f3f74b31576cc4d707a3d3b00d159cab8bb.zip |
[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>
-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) struct inode *inode = dentry->d_inode; struct timespec now; - if (inode->i_flags & S_NOATIME) + if (mnt_want_write(mnt)) return; + if (inode->i_flags & S_NOATIME) + goto out; if (IS_NOATIME(inode)) - return; + goto out; if ((inode->i_sb->s_flags & MS_NODIRATIME) && S_ISDIR(inode->i_mode)) - return; - - /* - * 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; + goto out; - if (mnt->mnt_flags & MNT_RELATIME) { - /* - * With relative atime, only update atime if the - * 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; - } + if (mnt->mnt_flags & MNT_NOATIME) + goto out; + if ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode)) + goto out; + if (mnt->mnt_flags & MNT_RELATIME) { + /* + * With relative atime, only update atime if the 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) + goto out; } now = current_fs_time(inode->i_sb); if (timespec_equal(&inode->i_atime, &now)) - return; + goto out; inode->i_atime = now; mark_inode_dirty_sync(inode); +out: + mnt_drop_write(mnt); } EXPORT_SYMBOL(touch_atime); |