Re: Problems with ACL over NFS

Andreas Gruenbacher <[email protected]> Sat, 29 Apr 2006 20:48:29 +0200
Newsgroups gmane.linux.file-systems.acl.devel
Organization Novell, SUSE Labs
Message-ID <[email protected]>
--Boundary-00=_9T7UERLSHvLQE6W
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Does the attached patch fix things for you?

Thanks,
Andreas

--Boundary-00=_9T7UERLSHvLQE6W
Content-Type: text/x-diff;
  charset="iso-8859-1";
  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:

--Boundary-00=_9T7UERLSHvLQE6W
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=_9T7UERLSHvLQE6W--