[PATCH 12/27] r-o-bind-mounts-elevate-write-count-for-do_sys_utime-and-touch_atime

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <akpm@...>
Cc: <linux-kernel@...>, <miklos@...>, <hch@...>, Dave Hansen <haveblue@...>
Date: Thursday, November 1, 2007 - 7:08 pm

Acked-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 linux-2.6.git-dave/fs/inode.c |   20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff -puN fs/inode.c~r-o-bind-mounts-elevate-write-count-for-do_sys_utime-and-touch_atime fs/inode.c
--- linux-2.6.git/fs/inode.c~r-o-bind-mounts-elevate-write-count-for-do_sys_utime-and-touch_atime	2007-11-01 14:46:12.000000000 -0700
+++ linux-2.6.git-dave/fs/inode.c	2007-11-01 14:46:12.000000000 -0700
@@ -1203,22 +1203,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
@@ -1229,16 +1230,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);
 
_
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 00/27] Read-only bind mounts (-mm resend), Dave Hansen, (Thu Nov 1, 7:08 pm)
[PATCH 12/27] r-o-bind-mounts-elevate-write-count-for-do_sys..., Dave Hansen, (Thu Nov 1, 7:08 pm)
[PATCH 06/27] r-o-bind-mounts-stub-functions, Dave Hansen, (Thu Nov 1, 7:08 pm)
[PATCH 05/27] rename open_namei() to open_pathname(), Dave Hansen, (Thu Nov 1, 7:08 pm)
Re: [PATCH 05/27] rename open_namei() to open_pathname(), Christoph Hellwig, (Mon Nov 26, 10:33 am)
[PATCH 04/27] kill filp_open(), Dave Hansen, (Thu Nov 1, 7:08 pm)
Re: [PATCH 04/27] kill filp_open(), Andrew Morton, (Wed Jan 16, 4:52 am)
Re: [PATCH 04/27] kill filp_open(), Dave Hansen, (Wed Jan 16, 1:04 pm)
Re: [PATCH 04/27] kill filp_open(), Bryn M. Reeves, (Wed Jan 16, 1:12 pm)
Re: [PATCH 04/27] kill filp_open(), Christoph Hellwig, (Wed Jan 16, 1:10 pm)
Re: [PATCH 04/27] kill filp_open(), Dave Hansen, (Wed Jan 16, 1:41 pm)
Re: [PATCH 04/27] kill filp_open(), Christoph Hellwig, (Wed Jan 16, 1:47 pm)
[PATCH 03/27] kill do_filp_open(), Dave Hansen, (Thu Nov 1, 7:08 pm)
[PATCH 02/27] make open_namei() return a filp, Dave Hansen, (Thu Nov 1, 7:08 pm)