Re: Problems with ACL over NFS

Andreas Gruenbacher <[email protected]> Sat, 29 Apr 2006 22:17:59 +0200
Newsgroups gmane.linux.file-systems.acl.devel
Organization SUSE Labs / Novell Inc.
Message-ID <[email protected]>
--Boundary-00=_3n8UE6WPOsgS4io
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Saturday 29 April 2006 22:07, Andreas Gruenbacher wrote:
> Update: I can still reproduce the problem that some `setfacl -m ...'
> changes are lost, so something else must still be broken. More info
> tomorrow.

This updated patch (untested) will probably fix it.

Andreas

--Boundary-00=_3n8UE6WPOsgS4io
Content-Type: text/x-diff;
  charset="utf-8";
  name="nfs-acl-caching.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="nfs-acl-caching.diff"

From: Andreas Gruenbacher <[email protected]>
Subject: "No acl" entry put in client-side acl cache instead of "not cached"
References: 171059

When the acl of a file is not cached and only the default acl of that
file is requested, a NULL "no acl" entry is put in the client-side acl
cache of nfs instead of ERR_PTR(-EAGAIN) "not cached".

Signed-off-by: Andreas Gruenbacher <[email protected]>

Index: linux-2.6.16/fs/nfs/nfs3acl.c
===================================================================
--- linux-2.6.16.orig/fs/nfs/nfs3acl.c
+++ linux-2.6.16/fs/nfs/nfs3acl.c
@@ -172,8 +172,10 @@ static void nfs3_cache_acls(struct inode
 		inode->i_ino, acl, dfacl);
 	spin_lock(&inode->i_lock);
 	__nfs3_forget_cached_acls(NFS_I(inode));
-	nfsi->acl_access = posix_acl_dup(acl);
-	nfsi->acl_default = posix_acl_dup(dfacl);
+	if (!IS_ERR(acl))
+		nfsi->acl_access = posix_acl_dup(acl);
+	if (!IS_ERR(dfacl))
+		nfsi->acl_default = posix_acl_dup(dfacl);
 	spin_unlock(&inode->i_lock);
 }
 
@@ -250,7 +252,9 @@ struct posix_acl *nfs3_proc_getacl(struc
 			res.acl_access = NULL;
 		}
 	}
-	nfs3_cache_acls(inode, res.acl_access, res.acl_default);
+	nfs3_cache_acls(inode,
+		(res.mask & NFS_ACL)   ? res.acl_access  : ERR_PTR(-EINVAL),
+		(res.mask & NFS_DFACL) ? res.acl_default : ERR_PTR(-EINVAL));
 
 	switch(type) {
 		case ACL_TYPE_ACCESS:
@@ -321,6 +325,7 @@ static int nfs3_proc_setacls(struct inod
 	switch (status) {
 		case 0:
 			status = nfs_refresh_inode(inode, &fattr);
+			nfs3_cache_acls(inode, acl, dfacl);
 			break;
 		case -EPFNOSUPPORT:
 		case -EPROTONOSUPPORT:

--Boundary-00=_3n8UE6WPOsgS4io
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
acl-devel mailing list
[email protected]
http://acl.bestbits.at/mailman/listinfo/acl-devel

--Boundary-00=_3n8UE6WPOsgS4io--