Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27922b4260f65d317aabda37e42bbbff > files > 1125

kernel-2.6.18-238.el5.src.rpm

From: Jeff Layton <jlayton@redhat.com>
Date: Fri, 2 Jul 2010 14:30:48 -0400
Subject: [fs] nfs: fix attribute updates even more
Message-id: <1278081049-10267-1-git-send-email-jlayton@redhat.com>
Patchwork-id: 26681
O-Subject: [RHEL5.6 PATCH 5/4] BZ#601800: NFS: Fix attribute updates
Bugzilla: 601800
RH-Acked-by: Steve Dickson <SteveD@redhat.com>

This patch is a backport of these two patches from upstream and fixes a
regression introduced by the patchset for bug 601800:

6d2b2966869142660f46d1e06cf9d15c3debcf77
03254e65a60d3113164672dbbadc023c4a56ecd1

The problem was a Connectathon test failure that would show up in the
link and rename test when running against a server with 1s timestamp
granularity. The cause is that the current code has the
nfsi->last_updated field representing the time of the last trip through
nfs_update_inode, regardless of whether the inode was actually updated
or not.

At the time that the patches for 601800 went upstream, the code had been
changed such that last_updated reflected the time that attributes last
became invalid and were replaced. The code in
nfs_inode_attrs_need_update depends on the latter interpretation. If
last_updated is always being changed, then that function will never
think that the inode needs updating.

Signed-off-by: Jeff Layton <jlayton@redhat.com>

diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 9860f64..16dced3 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -886,10 +886,10 @@ static int nfs_inode_attrs_need_update(const struct inode *inode, const struct n
 {
 	const struct nfs_inode *nfsi = NFS_I(inode);
 
-	return nfs_ctime_need_update(inode, fattr) ||
-			nfs_size_need_update(inode, fattr) ||
-			time_after(fattr->time_start, nfsi->last_updated) ||
-			time_after(nfsi->last_updated, jiffies);
+	return time_after(fattr->time_start, nfsi->last_updated) ||
+		nfs_ctime_need_update(inode, fattr) ||
+		nfs_size_need_update(inode, fattr) ||
+		time_after(nfsi->last_updated, jiffies);
 }
 
 static int nfs_refresh_inode_locked(struct inode *inode, struct nfs_fattr *fattr)
@@ -1015,7 +1015,6 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
 	 * Update the read time so we don't revalidate too often.
 	 */
 	nfsi->read_cache_jiffies = fattr->time_start;
-	nfsi->last_updated = jiffies;
 
 	nfsi->cache_validity &= ~(NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ATIME
 			| NFS_INO_REVAL_PAGECACHE);
@@ -1086,6 +1085,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
 		nfs_inc_stats(inode, NFSIOS_ATTRINVALIDATE);
 		nfsi->attrtimeo = NFS_MINATTRTIMEO(inode);
 		nfsi->attrtimeo_timestamp = jiffies;
+		nfsi->last_updated = jiffies;
 	} else if (!time_in_range_open(jiffies, nfsi->attrtimeo_timestamp,
 				nfsi->attrtimeo_timestamp + nfsi->attrtimeo)) {
 		if ((nfsi->attrtimeo <<= 1) > NFS_MAXATTRTIMEO(inode))