diff options
author | Andreas Gruenbacher <agruen@suse.de> | 2005-06-22 13:16:27 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2005-06-22 16:07:24 -0400 |
commit | b7fa0554cf1ba6d6895cd0a5b02989a26e0bc704 (patch) | |
tree | 83eb405f3ff78c17695999df38c99484e3aee01f /fs/nfs/inode.c | |
parent | a257cdd0e2179630d3201c32ba14d7fcb3c3a055 (diff) |
[PATCH] NFS: Add support for NFSv3 ACLs
This adds acl support fo nfs clients via the NFSACL protocol extension, by
implementing the getxattr, listxattr, setxattr, and removexattr iops for the
system.posix_acl_access and system.posix_acl_default attributes. This patch
implements a dumb version that uses no caching (and thus adds some overhead).
(Another patch in this patchset adds caching as well.)
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Acked-by: Olaf Kirch <okir@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r-- | fs/nfs/inode.c | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 97b3fe7ece63..440b9cbb6f81 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -108,6 +108,21 @@ static struct rpc_program nfs_program = { | |||
108 | .pipe_dir_name = "/nfs", | 108 | .pipe_dir_name = "/nfs", |
109 | }; | 109 | }; |
110 | 110 | ||
111 | #ifdef CONFIG_NFS_V3_ACL | ||
112 | static struct rpc_stat nfsacl_rpcstat = { &nfsacl_program }; | ||
113 | static struct rpc_version * nfsacl_version[] = { | ||
114 | [3] = &nfsacl_version3, | ||
115 | }; | ||
116 | |||
117 | struct rpc_program nfsacl_program = { | ||
118 | .name = "nfsacl", | ||
119 | .number = NFS_ACL_PROGRAM, | ||
120 | .nrvers = sizeof(nfsacl_version) / sizeof(nfsacl_version[0]), | ||
121 | .version = nfsacl_version, | ||
122 | .stats = &nfsacl_rpcstat, | ||
123 | }; | ||
124 | #endif /* CONFIG_NFS_V3_ACL */ | ||
125 | |||
111 | static inline unsigned long | 126 | static inline unsigned long |
112 | nfs_fattr_to_ino_t(struct nfs_fattr *fattr) | 127 | nfs_fattr_to_ino_t(struct nfs_fattr *fattr) |
113 | { | 128 | { |
@@ -165,6 +180,9 @@ nfs_umount_begin(struct super_block *sb) | |||
165 | /* -EIO all pending I/O */ | 180 | /* -EIO all pending I/O */ |
166 | if (!IS_ERR(rpc)) | 181 | if (!IS_ERR(rpc)) |
167 | rpc_killall_tasks(rpc); | 182 | rpc_killall_tasks(rpc); |
183 | rpc = NFS_SB(sb)->client_acl; | ||
184 | if (!IS_ERR(rpc)) | ||
185 | rpc_killall_tasks(rpc); | ||
168 | } | 186 | } |
169 | 187 | ||
170 | 188 | ||
@@ -461,8 +479,17 @@ nfs_fill_super(struct super_block *sb, struct nfs_mount_data *data, int silent) | |||
461 | atomic_inc(&server->client->cl_count); | 479 | atomic_inc(&server->client->cl_count); |
462 | server->client_sys = server->client; | 480 | server->client_sys = server->client; |
463 | } | 481 | } |
464 | |||
465 | if (server->flags & NFS_MOUNT_VER3) { | 482 | if (server->flags & NFS_MOUNT_VER3) { |
483 | #ifdef CONFIG_NFS_V3_ACL | ||
484 | if (!(server->flags & NFS_MOUNT_NOACL)) { | ||
485 | server->client_acl = rpc_bind_new_program(server->client, &nfsacl_program, 3); | ||
486 | /* No errors! Assume that Sun nfsacls are supported */ | ||
487 | if (!IS_ERR(server->client_acl)) | ||
488 | server->caps |= NFS_CAP_ACLS; | ||
489 | } | ||
490 | #else | ||
491 | server->flags &= ~NFS_MOUNT_NOACL; | ||
492 | #endif /* CONFIG_NFS_V3_ACL */ | ||
466 | if (server->namelen == 0 || server->namelen > NFS3_MAXNAMLEN) | 493 | if (server->namelen == 0 || server->namelen > NFS3_MAXNAMLEN) |
467 | server->namelen = NFS3_MAXNAMLEN; | 494 | server->namelen = NFS3_MAXNAMLEN; |
468 | sb->s_time_gran = 1; | 495 | sb->s_time_gran = 1; |
@@ -546,6 +573,7 @@ static int nfs_show_options(struct seq_file *m, struct vfsmount *mnt) | |||
546 | { NFS_MOUNT_NOCTO, ",nocto", "" }, | 573 | { NFS_MOUNT_NOCTO, ",nocto", "" }, |
547 | { NFS_MOUNT_NOAC, ",noac", "" }, | 574 | { NFS_MOUNT_NOAC, ",noac", "" }, |
548 | { NFS_MOUNT_NONLM, ",nolock", ",lock" }, | 575 | { NFS_MOUNT_NONLM, ",nolock", ",lock" }, |
576 | { NFS_MOUNT_NOACL, ",noacl", "" }, | ||
549 | { 0, NULL, NULL } | 577 | { 0, NULL, NULL } |
550 | }; | 578 | }; |
551 | struct proc_nfs_info *nfs_infop; | 579 | struct proc_nfs_info *nfs_infop; |
@@ -1452,7 +1480,7 @@ static struct super_block *nfs_get_sb(struct file_system_type *fs_type, | |||
1452 | memset(server, 0, sizeof(struct nfs_server)); | 1480 | memset(server, 0, sizeof(struct nfs_server)); |
1453 | /* Zero out the NFS state stuff */ | 1481 | /* Zero out the NFS state stuff */ |
1454 | init_nfsv4_state(server); | 1482 | init_nfsv4_state(server); |
1455 | server->client = server->client_sys = ERR_PTR(-EINVAL); | 1483 | server->client = server->client_sys = server->client_acl = ERR_PTR(-EINVAL); |
1456 | 1484 | ||
1457 | root = &server->fh; | 1485 | root = &server->fh; |
1458 | if (data->flags & NFS_MOUNT_VER3) | 1486 | if (data->flags & NFS_MOUNT_VER3) |
@@ -1513,6 +1541,8 @@ static void nfs_kill_super(struct super_block *s) | |||
1513 | rpc_shutdown_client(server->client); | 1541 | rpc_shutdown_client(server->client); |
1514 | if (!IS_ERR(server->client_sys)) | 1542 | if (!IS_ERR(server->client_sys)) |
1515 | rpc_shutdown_client(server->client_sys); | 1543 | rpc_shutdown_client(server->client_sys); |
1544 | if (!IS_ERR(server->client_acl)) | ||
1545 | rpc_shutdown_client(server->client_acl); | ||
1516 | 1546 | ||
1517 | if (!(server->flags & NFS_MOUNT_NONLM)) | 1547 | if (!(server->flags & NFS_MOUNT_NONLM)) |
1518 | lockd_down(); /* release rpc.lockd */ | 1548 | lockd_down(); /* release rpc.lockd */ |
@@ -1794,7 +1824,7 @@ static struct super_block *nfs4_get_sb(struct file_system_type *fs_type, | |||
1794 | memset(server, 0, sizeof(struct nfs_server)); | 1824 | memset(server, 0, sizeof(struct nfs_server)); |
1795 | /* Zero out the NFS state stuff */ | 1825 | /* Zero out the NFS state stuff */ |
1796 | init_nfsv4_state(server); | 1826 | init_nfsv4_state(server); |
1797 | server->client = server->client_sys = ERR_PTR(-EINVAL); | 1827 | server->client = server->client_sys = server->client_acl = ERR_PTR(-EINVAL); |
1798 | 1828 | ||
1799 | p = nfs_copy_user_string(NULL, &data->hostname, 256); | 1829 | p = nfs_copy_user_string(NULL, &data->hostname, 256); |
1800 | if (IS_ERR(p)) | 1830 | if (IS_ERR(p)) |