From: Andreas Gruenbacher <agruen@suse.de>
Subject: nfsacl: improve cache consistency

(This one is currently disabled.)

Index: linux-2.6.11-rc2/fs/nfs/inode.c
===================================================================
--- linux-2.6.11-rc2.orig/fs/nfs/inode.c
+++ linux-2.6.11-rc2/fs/nfs/inode.c
@@ -65,13 +65,8 @@ static int  nfs_statfs(struct super_bloc
 static int  nfs_show_options(struct seq_file *, struct vfsmount *);
 
 #ifdef CONFIG_NFS_ACL
-static void nfs_forget_cached_acls(struct inode *);
 static void __nfs_forget_cached_acls(struct nfs_inode *nfsi);
 #else
-static inline void nfs_forget_cached_acls(struct inode *inode)
-{
-}
-
 static inline void __nfs_forget_cached_acls(struct nfs_inode *nfsi)
 {
 }
@@ -1188,7 +1183,7 @@ static void __nfs_forget_cached_acls(str
 #endif  /* CONFIG_NFS_ACL */
 
 #ifdef CONFIG_NFS_ACL
-static void nfs_forget_cached_acls(struct inode *inode)
+void nfs_forget_cached_acls(struct inode *inode)
 {
 	dprintk("NFS: nfs_forget_cached_acls(%s/%ld)\n", inode->i_sb->s_id,
 		inode->i_ino);
@@ -1293,6 +1288,8 @@ int nfs_refresh_inode(struct inode *inod
 	if ((fattr->valid & NFS_ATTR_WCC) != 0) {
 		if (timespec_equal(&inode->i_ctime, &fattr->pre_ctime))
 			memcpy(&inode->i_ctime, &fattr->ctime, sizeof(inode->i_ctime));
+		else
+			nfs_forget_cached_acls(inode);
 		if (timespec_equal(&inode->i_mtime, &fattr->pre_mtime))
 			memcpy(&inode->i_mtime, &fattr->mtime, sizeof(inode->i_mtime));
 	}
Index: linux-2.6.11-rc2/fs/nfs/nfs3proc.c
===================================================================
--- linux-2.6.11-rc2.orig/fs/nfs/nfs3proc.c
+++ linux-2.6.11-rc2/fs/nfs/nfs3proc.c
@@ -876,7 +876,11 @@ nfs3_proc_setacls(struct inode *inode, s
 				acl = NULL;
 			}
 		}
-		nfs_cache_acls(inode, acl, dfacl);
+		if ((fattr.valid & NFS_ATTR_WCC) &&
+		    timespec_equal(&inode->i_ctime, &fattr.pre_ctime))
+			nfs_cache_acls(inode, acl, dfacl);
+		else
+			nfs_forget_cached_acls(inode);
 		status = nfs_refresh_inode(inode, &fattr);
 	}
 
Index: linux-2.6.11-rc2/include/linux/nfs_fs.h
===================================================================
--- linux-2.6.11-rc2.orig/include/linux/nfs_fs.h
+++ linux-2.6.11-rc2/include/linux/nfs_fs.h
@@ -293,6 +293,13 @@ extern struct inode *nfs_fhget(struct su
 				struct nfs_fattr *);
 extern struct posix_acl *nfs_get_cached_acl(struct inode *, int);
 extern void nfs_cache_acls(struct inode *, struct posix_acl *, struct posix_acl *);
+#ifdef CONFIG_NFS_ACL
+void nfs_forget_cached_acls(struct inode *);
+#else
+static inline void nfs_forget_cached_acls(struct inode *inode)
+{
+}
+#endif
 extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *);
 extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
 extern int nfs_permission(struct inode *, int, struct nameidata *);
