[PATCH 15/30] r/o bind mounts: write counts for time functions

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Dave Hansen
Date: Friday, February 15, 2008 - 3:37 pm

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>
---

 linux-2.6.git-dave/fs/inode.c |   45 ++++++++++++++++++------------------------
 1 file changed, 20 insertions(+), 25 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	2008-02-15 13:25:50.000000000 -0800
+++ linux-2.6.git-dave/fs/inode.c	2008-02-15 13:25:50.000000000 -0800
@@ -1199,42 +1199,37 @@ void touch_atime(struct vfsmount *mnt, s
 	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;
+		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) {
-			/*
-			 * 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);
 
_
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 00/30] Read-only bind mounts (-mm resend), Dave Hansen, (Fri Feb 15, 3:37 pm)
[PATCH 02/30] hppfs pass vfsmount to dentry_open(), Dave Hansen, (Fri Feb 15, 3:37 pm)
[PATCH 03/30] check for null vfsmount in dentry_open(), Dave Hansen, (Fri Feb 15, 3:37 pm)
[PATCH 04/30] fix up new filp allocators, Dave Hansen, (Fri Feb 15, 3:37 pm)
[PATCH 06/30] merge open_namei() and do_filp_open(), Dave Hansen, (Fri Feb 15, 3:37 pm)
[PATCH 07/30] r/o bind mounts: stub functions, Dave Hansen, (Fri Feb 15, 3:37 pm)
[PATCH 15/30] r/o bind mounts: write counts for time functions, Dave Hansen, (Fri Feb 15, 3:37 pm)
Re: [PATCH 07/30] r/o bind mounts: stub functions, Theodore Tso, (Fri Feb 15, 5:32 pm)
Re: [PATCH 07/30] r/o bind mounts: stub functions, Dave Hansen, (Fri Feb 15, 5:49 pm)
Re: [PATCH 07/30] r/o bind mounts: stub functions, Theodore Tso, (Fri Feb 15, 6:00 pm)
Re: [PATCH 07/30] r/o bind mounts: stub functions, Andrew Morton, (Fri Feb 15, 6:11 pm)
[PATCH] r/o bind mounts: stub functions, Dave Hansen, (Fri Feb 15, 6:32 pm)
Re: [PATCH 07/30] r/o bind mounts: stub functions, Christoph Hellwig, (Fri Feb 15, 11:31 pm)
Re: [PATCH 07/30] r/o bind mounts: stub functions, Andrew Morton, (Fri Feb 15, 11:46 pm)
Re: [PATCH 07/30] r/o bind mounts: stub functions, Dave Hansen, (Mon Feb 18, 12:06 am)
Re: [PATCH 07/30] r/o bind mounts: stub functions, Dave Hansen, (Wed Feb 20, 3:25 pm)
Re: [PATCH 07/30] r/o bind mounts: stub functions, Christoph Hellwig, (Wed Feb 20, 3:58 pm)