aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/client.c
diff options
context:
space:
mode:
authorBryan Schumaker <bjschuma@netapp.com>2012-07-30 16:05:19 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-07-30 19:05:54 -0400
commit1179acc6a3e260bc4edc74fa94f6c7908290eaec (patch)
treef84a56e4cc1ea6347383b29c83df19eae05eea0f /fs/nfs/client.c
parentff9099f26645818563c8d396a154c2ce6ee422eb (diff)
NFS: Only initialize the ACL client in the v3 case
v2 and v4 don't use it, so I create two new nfs_rpc_ops functions to initialize the ACL client only when we are using v3. Signed-off-by: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/client.c')
-rw-r--r--fs/nfs/client.c61
1 files changed, 5 insertions, 56 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 462de24482b4..1f2908287cba 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -83,22 +83,6 @@ struct rpc_stat nfs_rpcstat = {
83 .program = &nfs_program 83 .program = &nfs_program
84}; 84};
85 85
86
87#ifdef CONFIG_NFS_V3_ACL
88static struct rpc_stat nfsacl_rpcstat = { &nfsacl_program };
89static const struct rpc_version *nfsacl_version[] = {
90 [3] = &nfsacl_version3,
91};
92
93const struct rpc_program nfsacl_program = {
94 .name = "nfsacl",
95 .number = NFS_ACL_PROGRAM,
96 .nrvers = ARRAY_SIZE(nfsacl_version),
97 .version = nfsacl_version,
98 .stats = &nfsacl_rpcstat,
99};
100#endif /* CONFIG_NFS_V3_ACL */
101
102static struct nfs_subversion *find_nfs_version(unsigned int version) 86static struct nfs_subversion *find_nfs_version(unsigned int version)
103{ 87{
104 struct nfs_subversion *nfs; 88 struct nfs_subversion *nfs;
@@ -696,36 +680,6 @@ static int nfs_start_lockd(struct nfs_server *server)
696} 680}
697 681
698/* 682/*
699 * Initialise an NFSv3 ACL client connection
700 */
701#ifdef CONFIG_NFS_V3_ACL
702static void nfs_init_server_aclclient(struct nfs_server *server)
703{
704 if (server->nfs_client->rpc_ops->version != 3)
705 goto out_noacl;
706 if (server->flags & NFS_MOUNT_NOACL)
707 goto out_noacl;
708
709 server->client_acl = rpc_bind_new_program(server->client, &nfsacl_program, 3);
710 if (IS_ERR(server->client_acl))
711 goto out_noacl;
712
713 /* No errors! Assume that Sun nfsacls are supported */
714 server->caps |= NFS_CAP_ACLS;
715 return;
716
717out_noacl:
718 server->caps &= ~NFS_CAP_ACLS;
719}
720#else
721static inline void nfs_init_server_aclclient(struct nfs_server *server)
722{
723 server->flags &= ~NFS_MOUNT_NOACL;
724 server->caps &= ~NFS_CAP_ACLS;
725}
726#endif
727
728/*
729 * Create a general RPC client 683 * Create a general RPC client
730 */ 684 */
731int nfs_init_server_rpcclient(struct nfs_server *server, 685int nfs_init_server_rpcclient(struct nfs_server *server,
@@ -874,8 +828,6 @@ static int nfs_init_server(struct nfs_server *server,
874 server->mountd_protocol = data->mount_server.protocol; 828 server->mountd_protocol = data->mount_server.protocol;
875 829
876 server->namelen = data->namlen; 830 server->namelen = data->namlen;
877 /* Create a client RPC handle for the NFSv3 ACL management interface */
878 nfs_init_server_aclclient(server);
879 dprintk("<-- nfs_init_server() = 0 [new %p]\n", clp); 831 dprintk("<-- nfs_init_server() = 0 [new %p]\n", clp);
880 return 0; 832 return 0;
881 833
@@ -1108,8 +1060,7 @@ void nfs_free_server(struct nfs_server *server)
1108 * Create a version 2 or 3 volume record 1060 * Create a version 2 or 3 volume record
1109 * - keyed on server and FSID 1061 * - keyed on server and FSID
1110 */ 1062 */
1111struct nfs_server *nfs_create_server(const struct nfs_parsed_mount_data *data, 1063struct nfs_server *nfs_create_server(struct nfs_mount_info *mount_info,
1112 struct nfs_fh *mntfh,
1113 struct nfs_subversion *nfs_mod) 1064 struct nfs_subversion *nfs_mod)
1114{ 1065{
1115 struct nfs_server *server; 1066 struct nfs_server *server;
@@ -1126,7 +1077,7 @@ struct nfs_server *nfs_create_server(const struct nfs_parsed_mount_data *data,
1126 goto error; 1077 goto error;
1127 1078
1128 /* Get a client representation */ 1079 /* Get a client representation */
1129 error = nfs_init_server(server, data, nfs_mod); 1080 error = nfs_init_server(server, mount_info->parsed, nfs_mod);
1130 if (error < 0) 1081 if (error < 0)
1131 goto error; 1082 goto error;
1132 1083
@@ -1135,13 +1086,13 @@ struct nfs_server *nfs_create_server(const struct nfs_parsed_mount_data *data,
1135 BUG_ON(!server->nfs_client->rpc_ops->file_inode_ops); 1086 BUG_ON(!server->nfs_client->rpc_ops->file_inode_ops);
1136 1087
1137 /* Probe the root fh to retrieve its FSID */ 1088 /* Probe the root fh to retrieve its FSID */
1138 error = nfs_probe_fsinfo(server, mntfh, fattr); 1089 error = nfs_probe_fsinfo(server, mount_info->mntfh, fattr);
1139 if (error < 0) 1090 if (error < 0)
1140 goto error; 1091 goto error;
1141 if (server->nfs_client->rpc_ops->version == 3) { 1092 if (server->nfs_client->rpc_ops->version == 3) {
1142 if (server->namelen == 0 || server->namelen > NFS3_MAXNAMLEN) 1093 if (server->namelen == 0 || server->namelen > NFS3_MAXNAMLEN)
1143 server->namelen = NFS3_MAXNAMLEN; 1094 server->namelen = NFS3_MAXNAMLEN;
1144 if (!(data->flags & NFS_MOUNT_NORDIRPLUS)) 1095 if (!(mount_info->parsed->flags & NFS_MOUNT_NORDIRPLUS))
1145 server->caps |= NFS_CAP_READDIRPLUS; 1096 server->caps |= NFS_CAP_READDIRPLUS;
1146 } else { 1097 } else {
1147 if (server->namelen == 0 || server->namelen > NFS2_MAXNAMLEN) 1098 if (server->namelen == 0 || server->namelen > NFS2_MAXNAMLEN)
@@ -1149,7 +1100,7 @@ struct nfs_server *nfs_create_server(const struct nfs_parsed_mount_data *data,
1149 } 1100 }
1150 1101
1151 if (!(fattr->valid & NFS_ATTR_FATTR)) { 1102 if (!(fattr->valid & NFS_ATTR_FATTR)) {
1152 error = server->nfs_client->rpc_ops->getattr(server, mntfh, fattr); 1103 error = nfs_mod->rpc_ops->getattr(server, mount_info->mntfh, fattr);
1153 if (error < 0) { 1104 if (error < 0) {
1154 dprintk("nfs_create_server: getattr error = %d\n", -error); 1105 dprintk("nfs_create_server: getattr error = %d\n", -error);
1155 goto error; 1106 goto error;
@@ -1210,8 +1161,6 @@ struct nfs_server *nfs_clone_server(struct nfs_server *source,
1210 flavor); 1161 flavor);
1211 if (error < 0) 1162 if (error < 0)
1212 goto out_free_server; 1163 goto out_free_server;
1213 if (!IS_ERR(source->client_acl))
1214 nfs_init_server_aclclient(server);
1215 1164
1216 /* probe the filesystem info for this server filesystem */ 1165 /* probe the filesystem info for this server filesystem */
1217 error = nfs_probe_fsinfo(server, fh, fattr_fsinfo); 1166 error = nfs_probe_fsinfo(server, fh, fattr_fsinfo);