aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfsctl.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2006-10-02 05:17:46 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-02 10:57:17 -0400
commit6658d3a7bbfd1768a7b599def47939417f0ee8ef (patch)
treefd3ddac035bac92204836de1e11a0078fe54d5b9 /fs/nfsd/nfsctl.c
parent24e36663c375df577d2dcae437713481ffd6850c (diff)
[PATCH] knfsd: remove nfsd_versbits as intermediate storage for desired versions
We have an array 'nfsd_version' which lists the available versions of nfsd, and 'nfsd_versions' (poor choice there :-() which lists the currently active versions. Then we have a bitmap - nfsd_versbits which says which versions are wanted. The bits in this bitset cause content to be copied from nfsd_version to nfsd_versions when nfsd starts. This patch removes nfsd_versbits and moves information directly from nfsd_version to nfsd_versions when requests for version changes arrive. Note that this doesn't make it possible to change versions while the server is running. This is because serv->sv_xdrsize is calculated when a service is created, and used when threads are created, and xdrsize depends on the active versions. Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/nfsd/nfsctl.c')
-rw-r--r--fs/nfsd/nfsctl.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 7046ac9cf97f..d6881774ea57 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -35,8 +35,6 @@
35 35
36#include <asm/uaccess.h> 36#include <asm/uaccess.h>
37 37
38unsigned int nfsd_versbits = ~0;
39
40/* 38/*
41 * We have a single directory with 9 nodes in it. 39 * We have a single directory with 9 nodes in it.
42 */ 40 */
@@ -372,6 +370,10 @@ static ssize_t write_versions(struct file *file, char *buf, size_t size)
372 370
373 if (size>0) { 371 if (size>0) {
374 if (nfsd_serv) 372 if (nfsd_serv)
373 /* Cannot change versions without updating
374 * nfsd_serv->sv_xdrsize, and reallocing
375 * rq_argp and rq_resp
376 */
375 return -EBUSY; 377 return -EBUSY;
376 if (buf[size-1] != '\n') 378 if (buf[size-1] != '\n')
377 return -EINVAL; 379 return -EINVAL;
@@ -390,10 +392,7 @@ static ssize_t write_versions(struct file *file, char *buf, size_t size)
390 case 2: 392 case 2:
391 case 3: 393 case 3:
392 case 4: 394 case 4:
393 if (sign != '-') 395 nfsd_vers(num, sign == '-' ? NFSD_CLEAR : NFSD_SET);
394 NFSCTL_VERSET(nfsd_versbits, num);
395 else
396 NFSCTL_VERUNSET(nfsd_versbits, num);
397 break; 396 break;
398 default: 397 default:
399 return -EINVAL; 398 return -EINVAL;
@@ -404,16 +403,15 @@ static ssize_t write_versions(struct file *file, char *buf, size_t size)
404 /* If all get turned off, turn them back on, as 403 /* If all get turned off, turn them back on, as
405 * having no versions is BAD 404 * having no versions is BAD
406 */ 405 */
407 if ((nfsd_versbits & NFSCTL_VERALL)==0) 406 nfsd_reset_versions();
408 nfsd_versbits = NFSCTL_VERALL;
409 } 407 }
410 /* Now write current state into reply buffer */ 408 /* Now write current state into reply buffer */
411 len = 0; 409 len = 0;
412 sep = ""; 410 sep = "";
413 for (num=2 ; num <= 4 ; num++) 411 for (num=2 ; num <= 4 ; num++)
414 if (NFSCTL_VERISSET(NFSCTL_VERALL, num)) { 412 if (nfsd_vers(num, NFSD_AVAIL)) {
415 len += sprintf(buf+len, "%s%c%d", sep, 413 len += sprintf(buf+len, "%s%c%d", sep,
416 NFSCTL_VERISSET(nfsd_versbits, num)?'+':'-', 414 nfsd_vers(num, NFSD_TEST)?'+':'-',
417 num); 415 num);
418 sep = " "; 416 sep = " ";
419 } 417 }