aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2005-06-22 13:16:23 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2005-06-22 16:07:14 -0400
commit4b580ee3dc00f9828a9a7aad2724f448fdc94075 (patch)
treea39ca6a5be4766420c6cc6ea8141fb421280bcb3
parent23ec6965c20db96bc8ea7af0ec178f074dd31c40 (diff)
[PATCH] NFSv4: ACL support for the NFSv4 client: write
Client-side write support for NFSv4 ACLs. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--fs/nfs/nfs4proc.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index c91c09938a55..d969dd13e7db 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2216,6 +2216,29 @@ static ssize_t nfs4_proc_get_acl(struct inode *inode, void *buf, size_t buflen)
2216 return ret; 2216 return ret;
2217} 2217}
2218 2218
2219static int nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t buflen)
2220{
2221 struct nfs_server *server = NFS_SERVER(inode);
2222 struct page *pages[NFS4ACL_MAXPAGES];
2223 struct nfs_setaclargs arg = {
2224 .fh = NFS_FH(inode),
2225 .acl_pages = pages,
2226 .acl_len = buflen,
2227 };
2228 struct rpc_message msg = {
2229 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_SETACL],
2230 .rpc_argp = &arg,
2231 .rpc_resp = NULL,
2232 };
2233 int ret;
2234
2235 if (!nfs4_server_supports_acls(server))
2236 return -EOPNOTSUPP;
2237 buf_to_pages(buf, buflen, arg.acl_pages, &arg.acl_pgbase);
2238 ret = rpc_call_sync(NFS_SERVER(inode)->client, &msg, 0);
2239 return ret;
2240}
2241
2219static int 2242static int
2220nfs4_async_handle_error(struct rpc_task *task, struct nfs_server *server) 2243nfs4_async_handle_error(struct rpc_task *task, struct nfs_server *server)
2221{ 2244{
@@ -2792,7 +2815,16 @@ nfs4_proc_lock(struct file *filp, int cmd, struct file_lock *request)
2792int nfs4_setxattr(struct dentry *dentry, const char *key, const void *buf, 2815int nfs4_setxattr(struct dentry *dentry, const char *key, const void *buf,
2793 size_t buflen, int flags) 2816 size_t buflen, int flags)
2794{ 2817{
2795 return -EOPNOTSUPP; 2818 struct inode *inode = dentry->d_inode;
2819
2820 if (strcmp(key, XATTR_NAME_NFSV4_ACL) != 0)
2821 return -EOPNOTSUPP;
2822
2823 if (!S_ISREG(inode->i_mode) &&
2824 (!S_ISDIR(inode->i_mode) || inode->i_mode & S_ISVTX))
2825 return -EPERM;
2826
2827 return nfs4_proc_set_acl(inode, buf, buflen);
2796} 2828}
2797 2829
2798/* The getxattr man page suggests returning -ENODATA for unknown attributes, 2830/* The getxattr man page suggests returning -ENODATA for unknown attributes,