From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave Hansen Subject: [PATCH 20/23] elevate write count for do_sys_utime() and touch_atime() Date: Wed, 11 Jul 2007 17:17:37 -0700 Message-ID: <20070712001737.7E9156D0@kernel> References: <20070712001710.654CD9ED@kernel> Cc: linux-fsdevel@vger.kernel.org, viro@zeniv.linux.org.uk, hch@infradead.org, Dave Hansen To: linux-kernel@vger.kernel.org Return-path: Received: from e32.co.us.ibm.com ([32.97.110.150]:36304 "EHLO e32.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S937550AbXGLARn (ORCPT ); Wed, 11 Jul 2007 20:17:43 -0400 In-Reply-To: <20070712001710.654CD9ED@kernel> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org Signed-off-by: Dave Hansen --- lxc-dave/fs/inode.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff -puN fs/inode.c~elevate-write-count-for-do-sys-utime-and-touch-atime fs/inode.c --- lxc/fs/inode.c~elevate-write-count-for-do-sys-utime-and-touch-atime 2007-07-10 12:46:15.000000000 -0700 +++ lxc-dave/fs/inode.c 2007-07-10 12:46:15.000000000 -0700 @@ -1165,22 +1165,23 @@ void touch_atime(struct vfsmount *mnt, s struct inode *inode = dentry->d_inode; struct timespec now; - if (inode->i_flags & S_NOATIME) + if (mnt && 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; + goto out; /* * We may have a NULL vfsmount when coming from NFSD */ if (mnt) { if (mnt->mnt_flags & MNT_NOATIME) - return; + goto out; 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 @@ -1191,16 +1192,19 @@ void touch_atime(struct vfsmount *mnt, s &inode->i_atime) < 0 && timespec_compare(&inode->i_ctime, &inode->i_atime) < 0) - return; + 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: + if (mnt) + mnt_drop_write(mnt); } EXPORT_SYMBOL(touch_atime); _