diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-22 10:54:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-22 10:54:33 -0400 |
commit | a87e84b5cdfacf11af4e8a85c4bca9793658536f (patch) | |
tree | f8e3cb2d339d8ed0e987d55f725e501730cdc81d /fs/nfsd/nfssvc.c | |
parent | 342ff1a1b558ebbdb8cbd55ab6a63eca8b2473ca (diff) | |
parent | 3c394ddaa7ea4205f933fd9b481166b2669368a9 (diff) |
Merge branch 'for-2.6.32' of git://linux-nfs.org/~bfields/linux
* 'for-2.6.32' of git://linux-nfs.org/~bfields/linux: (68 commits)
nfsd4: nfsv4 clients should cross mountpoints
nfsd: revise 4.1 status documentation
sunrpc/cache: avoid variable over-loading in cache_defer_req
sunrpc/cache: use list_del_init for the list_head entries in cache_deferred_req
nfsd: return success for non-NFS4 nfs4_state_start
nfsd41: Refactor create_client()
nfsd41: modify nfsd4.1 backchannel to use new xprt class
nfsd41: Backchannel: Implement cb_recall over NFSv4.1
nfsd41: Backchannel: cb_sequence callback
nfsd41: Backchannel: Setup sequence information
nfsd41: Backchannel: Server backchannel RPC wait queue
nfsd41: Backchannel: Add sequence arguments to callback RPC arguments
nfsd41: Backchannel: callback infrastructure
nfsd4: use common rpc_cred for all callbacks
nfsd4: allow nfs4 state startup to fail
SUNRPC: Defer the auth_gss upcall when the RPC call is asynchronous
nfsd4: fix null dereference creating nfsv4 callback client
nfsd4: fix whitespace in NFSPROC4_CLNT_CB_NULL definition
nfsd41: sunrpc: add new xprt class for nfsv4.1 backchannel
sunrpc/cache: simplify cache_fresh_locked and cache_fresh_unlocked.
...
Diffstat (limited to 'fs/nfsd/nfssvc.c')
-rw-r--r-- | fs/nfsd/nfssvc.c | 54 |
1 files changed, 40 insertions, 14 deletions
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index 24d58adfe5fd..67ea83eedd43 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/nfsd/syscall.h> | 34 | #include <linux/nfsd/syscall.h> |
35 | #include <linux/lockd/bind.h> | 35 | #include <linux/lockd/bind.h> |
36 | #include <linux/nfsacl.h> | 36 | #include <linux/nfsacl.h> |
37 | #include <linux/seq_file.h> | ||
37 | 38 | ||
38 | #define NFSDDBG_FACILITY NFSDDBG_SVC | 39 | #define NFSDDBG_FACILITY NFSDDBG_SVC |
39 | 40 | ||
@@ -66,6 +67,16 @@ struct timeval nfssvc_boot; | |||
66 | DEFINE_MUTEX(nfsd_mutex); | 67 | DEFINE_MUTEX(nfsd_mutex); |
67 | struct svc_serv *nfsd_serv; | 68 | struct svc_serv *nfsd_serv; |
68 | 69 | ||
70 | /* | ||
71 | * nfsd_drc_lock protects nfsd_drc_max_pages and nfsd_drc_pages_used. | ||
72 | * nfsd_drc_max_pages limits the total amount of memory available for | ||
73 | * version 4.1 DRC caches. | ||
74 | * nfsd_drc_pages_used tracks the current version 4.1 DRC memory usage. | ||
75 | */ | ||
76 | spinlock_t nfsd_drc_lock; | ||
77 | unsigned int nfsd_drc_max_mem; | ||
78 | unsigned int nfsd_drc_mem_used; | ||
79 | |||
69 | #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) | 80 | #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) |
70 | static struct svc_stat nfsd_acl_svcstats; | 81 | static struct svc_stat nfsd_acl_svcstats; |
71 | static struct svc_version * nfsd_acl_version[] = { | 82 | static struct svc_version * nfsd_acl_version[] = { |
@@ -235,13 +246,12 @@ void nfsd_reset_versions(void) | |||
235 | */ | 246 | */ |
236 | static void set_max_drc(void) | 247 | static void set_max_drc(void) |
237 | { | 248 | { |
238 | /* The percent of nr_free_buffer_pages used by the V4.1 server DRC */ | 249 | #define NFSD_DRC_SIZE_SHIFT 10 |
239 | #define NFSD_DRC_SIZE_SHIFT 7 | 250 | nfsd_drc_max_mem = (nr_free_buffer_pages() |
240 | nfsd_serv->sv_drc_max_pages = nr_free_buffer_pages() | 251 | >> NFSD_DRC_SIZE_SHIFT) * PAGE_SIZE; |
241 | >> NFSD_DRC_SIZE_SHIFT; | 252 | nfsd_drc_mem_used = 0; |
242 | nfsd_serv->sv_drc_pages_used = 0; | 253 | spin_lock_init(&nfsd_drc_lock); |
243 | dprintk("%s svc_drc_max_pages %u\n", __func__, | 254 | dprintk("%s nfsd_drc_max_mem %u \n", __func__, nfsd_drc_max_mem); |
244 | nfsd_serv->sv_drc_max_pages); | ||
245 | } | 255 | } |
246 | 256 | ||
247 | int nfsd_create_serv(void) | 257 | int nfsd_create_serv(void) |
@@ -401,7 +411,9 @@ nfsd_svc(unsigned short port, int nrservs) | |||
401 | error = nfsd_racache_init(2*nrservs); | 411 | error = nfsd_racache_init(2*nrservs); |
402 | if (error<0) | 412 | if (error<0) |
403 | goto out; | 413 | goto out; |
404 | nfs4_state_start(); | 414 | error = nfs4_state_start(); |
415 | if (error) | ||
416 | goto out; | ||
405 | 417 | ||
406 | nfsd_reset_versions(); | 418 | nfsd_reset_versions(); |
407 | 419 | ||
@@ -569,10 +581,6 @@ nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp) | |||
569 | + rqstp->rq_res.head[0].iov_len; | 581 | + rqstp->rq_res.head[0].iov_len; |
570 | rqstp->rq_res.head[0].iov_len += sizeof(__be32); | 582 | rqstp->rq_res.head[0].iov_len += sizeof(__be32); |
571 | 583 | ||
572 | /* NFSv4.1 DRC requires statp */ | ||
573 | if (rqstp->rq_vers == 4) | ||
574 | nfsd4_set_statp(rqstp, statp); | ||
575 | |||
576 | /* Now call the procedure handler, and encode NFS status. */ | 584 | /* Now call the procedure handler, and encode NFS status. */ |
577 | nfserr = proc->pc_func(rqstp, rqstp->rq_argp, rqstp->rq_resp); | 585 | nfserr = proc->pc_func(rqstp, rqstp->rq_argp, rqstp->rq_resp); |
578 | nfserr = map_new_errors(rqstp->rq_vers, nfserr); | 586 | nfserr = map_new_errors(rqstp->rq_vers, nfserr); |
@@ -607,7 +615,25 @@ nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp) | |||
607 | 615 | ||
608 | int nfsd_pool_stats_open(struct inode *inode, struct file *file) | 616 | int nfsd_pool_stats_open(struct inode *inode, struct file *file) |
609 | { | 617 | { |
610 | if (nfsd_serv == NULL) | 618 | int ret; |
619 | mutex_lock(&nfsd_mutex); | ||
620 | if (nfsd_serv == NULL) { | ||
621 | mutex_unlock(&nfsd_mutex); | ||
611 | return -ENODEV; | 622 | return -ENODEV; |
612 | return svc_pool_stats_open(nfsd_serv, file); | 623 | } |
624 | /* bump up the psudo refcount while traversing */ | ||
625 | svc_get(nfsd_serv); | ||
626 | ret = svc_pool_stats_open(nfsd_serv, file); | ||
627 | mutex_unlock(&nfsd_mutex); | ||
628 | return ret; | ||
629 | } | ||
630 | |||
631 | int nfsd_pool_stats_release(struct inode *inode, struct file *file) | ||
632 | { | ||
633 | int ret = seq_release(inode, file); | ||
634 | mutex_lock(&nfsd_mutex); | ||
635 | /* this function really, really should have been called svc_put() */ | ||
636 | svc_destroy(nfsd_serv); | ||
637 | mutex_unlock(&nfsd_mutex); | ||
638 | return ret; | ||
613 | } | 639 | } |