diff options
Diffstat (limited to 'fs/nfsd/nfssvc.c')
-rw-r--r-- | fs/nfsd/nfssvc.c | 93 |
1 files changed, 50 insertions, 43 deletions
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index 0339b4ddfa3b..140e3a2d1b9f 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c | |||
@@ -117,6 +117,32 @@ struct svc_program nfsd_program = { | |||
117 | 117 | ||
118 | }; | 118 | }; |
119 | 119 | ||
120 | int nfsd_vers(int vers, enum vers_op change) | ||
121 | { | ||
122 | if (vers < NFSD_MINVERS || vers >= NFSD_NRVERS) | ||
123 | return -1; | ||
124 | switch(change) { | ||
125 | case NFSD_SET: | ||
126 | nfsd_versions[vers] = nfsd_version[vers]; | ||
127 | break; | ||
128 | #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) | ||
129 | if (vers < NFSD_ACL_NRVERS) | ||
130 | nfsd_acl_version[vers] = nfsd_acl_version[vers]; | ||
131 | #endif | ||
132 | case NFSD_CLEAR: | ||
133 | nfsd_versions[vers] = NULL; | ||
134 | #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) | ||
135 | if (vers < NFSD_ACL_NRVERS) | ||
136 | nfsd_acl_version[vers] = NULL; | ||
137 | #endif | ||
138 | break; | ||
139 | case NFSD_TEST: | ||
140 | return nfsd_versions[vers] != NULL; | ||
141 | case NFSD_AVAIL: | ||
142 | return nfsd_version[vers] != NULL; | ||
143 | } | ||
144 | return 0; | ||
145 | } | ||
120 | /* | 146 | /* |
121 | * Maximum number of nfsd processes | 147 | * Maximum number of nfsd processes |
122 | */ | 148 | */ |
@@ -147,16 +173,36 @@ static void nfsd_last_thread(struct svc_serv *serv) | |||
147 | nfsd_export_flush(); | 173 | nfsd_export_flush(); |
148 | } | 174 | } |
149 | } | 175 | } |
176 | |||
177 | void nfsd_reset_versions(void) | ||
178 | { | ||
179 | int found_one = 0; | ||
180 | int i; | ||
181 | |||
182 | for (i = NFSD_MINVERS; i < NFSD_NRVERS; i++) { | ||
183 | if (nfsd_program.pg_vers[i]) | ||
184 | found_one = 1; | ||
185 | } | ||
186 | |||
187 | if (!found_one) { | ||
188 | for (i = NFSD_MINVERS; i < NFSD_NRVERS; i++) | ||
189 | nfsd_program.pg_vers[i] = nfsd_version[i]; | ||
190 | #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) | ||
191 | for (i = NFSD_ACL_MINVERS; i < NFSD_ACL_NRVERS; i++) | ||
192 | nfsd_acl_program.pg_vers[i] = | ||
193 | nfsd_acl_version[i]; | ||
194 | #endif | ||
195 | } | ||
196 | } | ||
197 | |||
150 | int | 198 | int |
151 | nfsd_svc(unsigned short port, int nrservs) | 199 | nfsd_svc(unsigned short port, int nrservs) |
152 | { | 200 | { |
153 | int error; | 201 | int error; |
154 | int found_one, i; | ||
155 | struct list_head *victim; | 202 | struct list_head *victim; |
156 | 203 | ||
157 | lock_kernel(); | 204 | lock_kernel(); |
158 | dprintk("nfsd: creating service: vers 0x%x\n", | 205 | dprintk("nfsd: creating service\n"); |
159 | nfsd_versbits); | ||
160 | error = -EINVAL; | 206 | error = -EINVAL; |
161 | if (nrservs <= 0) | 207 | if (nrservs <= 0) |
162 | nrservs = 0; | 208 | nrservs = 0; |
@@ -171,46 +217,7 @@ nfsd_svc(unsigned short port, int nrservs) | |||
171 | if (error<0) | 217 | if (error<0) |
172 | goto out; | 218 | goto out; |
173 | if (!nfsd_serv) { | 219 | if (!nfsd_serv) { |
174 | /* | 220 | nfsd_reset_versions(); |
175 | * Use the nfsd_ctlbits to define which | ||
176 | * versions that will be advertised. | ||
177 | * If nfsd_ctlbits doesn't list any version, | ||
178 | * export them all. | ||
179 | */ | ||
180 | found_one = 0; | ||
181 | |||
182 | for (i = NFSD_MINVERS; i < NFSD_NRVERS; i++) { | ||
183 | if (NFSCTL_VERISSET(nfsd_versbits, i)) { | ||
184 | nfsd_program.pg_vers[i] = nfsd_version[i]; | ||
185 | found_one = 1; | ||
186 | } else | ||
187 | nfsd_program.pg_vers[i] = NULL; | ||
188 | } | ||
189 | |||
190 | if (!found_one) { | ||
191 | for (i = NFSD_MINVERS; i < NFSD_NRVERS; i++) | ||
192 | nfsd_program.pg_vers[i] = nfsd_version[i]; | ||
193 | } | ||
194 | |||
195 | |||
196 | #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) | ||
197 | found_one = 0; | ||
198 | |||
199 | for (i = NFSD_ACL_MINVERS; i < NFSD_ACL_NRVERS; i++) { | ||
200 | if (NFSCTL_VERISSET(nfsd_versbits, i)) { | ||
201 | nfsd_acl_program.pg_vers[i] = | ||
202 | nfsd_acl_version[i]; | ||
203 | found_one = 1; | ||
204 | } else | ||
205 | nfsd_acl_program.pg_vers[i] = NULL; | ||
206 | } | ||
207 | |||
208 | if (!found_one) { | ||
209 | for (i = NFSD_ACL_MINVERS; i < NFSD_ACL_NRVERS; i++) | ||
210 | nfsd_acl_program.pg_vers[i] = | ||
211 | nfsd_acl_version[i]; | ||
212 | } | ||
213 | #endif | ||
214 | 221 | ||
215 | atomic_set(&nfsd_busy, 0); | 222 | atomic_set(&nfsd_busy, 0); |
216 | error = -ENOMEM; | 223 | error = -ENOMEM; |