aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/nfs4state.c28
-rw-r--r--fs/nfsd/nfs4xdr.c2
2 files changed, 16 insertions, 14 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 89d9ac55c034..d5caf2a709d2 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -444,8 +444,8 @@ static int set_forechannel_maxreqs(struct nfsd4_channel_attrs *fchan)
444 * fchan holds the client values on input, and the server values on output 444 * fchan holds the client values on input, and the server values on output
445 */ 445 */
446static int init_forechannel_attrs(struct svc_rqst *rqstp, 446static int init_forechannel_attrs(struct svc_rqst *rqstp,
447 struct nfsd4_session *session, 447 struct nfsd4_channel_attrs *session_fchan,
448 struct nfsd4_channel_attrs *fchan) 448 struct nfsd4_channel_attrs *fchan)
449{ 449{
450 int status = 0; 450 int status = 0;
451 __u32 maxcount = svc_max_payload(rqstp); 451 __u32 maxcount = svc_max_payload(rqstp);
@@ -455,21 +455,21 @@ static int init_forechannel_attrs(struct svc_rqst *rqstp,
455 /* Use the client's max request and max response size if possible */ 455 /* Use the client's max request and max response size if possible */
456 if (fchan->maxreq_sz > maxcount) 456 if (fchan->maxreq_sz > maxcount)
457 fchan->maxreq_sz = maxcount; 457 fchan->maxreq_sz = maxcount;
458 session->se_fmaxreq_sz = fchan->maxreq_sz; 458 session_fchan->maxreq_sz = fchan->maxreq_sz;
459 459
460 if (fchan->maxresp_sz > maxcount) 460 if (fchan->maxresp_sz > maxcount)
461 fchan->maxresp_sz = maxcount; 461 fchan->maxresp_sz = maxcount;
462 session->se_fmaxresp_sz = fchan->maxresp_sz; 462 session_fchan->maxresp_sz = fchan->maxresp_sz;
463 463
464 /* Set the max response cached size our default which is 464 /* Set the max response cached size our default which is
465 * a multiple of PAGE_SIZE and small */ 465 * a multiple of PAGE_SIZE and small */
466 session->se_fmaxresp_cached = NFSD_PAGES_PER_SLOT * PAGE_SIZE; 466 session_fchan->maxresp_cached = NFSD_PAGES_PER_SLOT * PAGE_SIZE;
467 fchan->maxresp_cached = session->se_fmaxresp_cached; 467 fchan->maxresp_cached = session_fchan->maxresp_cached;
468 468
469 /* Use the client's maxops if possible */ 469 /* Use the client's maxops if possible */
470 if (fchan->maxops > NFSD_MAX_OPS_PER_COMPOUND) 470 if (fchan->maxops > NFSD_MAX_OPS_PER_COMPOUND)
471 fchan->maxops = NFSD_MAX_OPS_PER_COMPOUND; 471 fchan->maxops = NFSD_MAX_OPS_PER_COMPOUND;
472 session->se_fmaxops = fchan->maxops; 472 session_fchan->maxops = fchan->maxops;
473 473
474 /* try to use the client requested number of slots */ 474 /* try to use the client requested number of slots */
475 if (fchan->maxreqs > NFSD_MAX_SLOTS_PER_SESSION) 475 if (fchan->maxreqs > NFSD_MAX_SLOTS_PER_SESSION)
@@ -481,7 +481,7 @@ static int init_forechannel_attrs(struct svc_rqst *rqstp,
481 */ 481 */
482 status = set_forechannel_maxreqs(fchan); 482 status = set_forechannel_maxreqs(fchan);
483 483
484 session->se_fnumslots = fchan->maxreqs; 484 session_fchan->maxreqs = fchan->maxreqs;
485 return status; 485 return status;
486} 486}
487 487
@@ -495,12 +495,14 @@ alloc_init_session(struct svc_rqst *rqstp, struct nfs4_client *clp,
495 memset(&tmp, 0, sizeof(tmp)); 495 memset(&tmp, 0, sizeof(tmp));
496 496
497 /* FIXME: For now, we just accept the client back channel attributes. */ 497 /* FIXME: For now, we just accept the client back channel attributes. */
498 status = init_forechannel_attrs(rqstp, &tmp, &cses->fore_channel); 498 tmp.se_bchannel = cses->back_channel;
499 status = init_forechannel_attrs(rqstp, &tmp.se_fchannel,
500 &cses->fore_channel);
499 if (status) 501 if (status)
500 goto out; 502 goto out;
501 503
502 /* allocate struct nfsd4_session and slot table in one piece */ 504 /* allocate struct nfsd4_session and slot table in one piece */
503 slotsize = tmp.se_fnumslots * sizeof(struct nfsd4_slot); 505 slotsize = tmp.se_fchannel.maxreqs * sizeof(struct nfsd4_slot);
504 new = kzalloc(sizeof(*new) + slotsize, GFP_KERNEL); 506 new = kzalloc(sizeof(*new) + slotsize, GFP_KERNEL);
505 if (!new) 507 if (!new)
506 goto out; 508 goto out;
@@ -574,7 +576,7 @@ free_session(struct kref *kref)
574 int i; 576 int i;
575 577
576 ses = container_of(kref, struct nfsd4_session, se_ref); 578 ses = container_of(kref, struct nfsd4_session, se_ref);
577 for (i = 0; i < ses->se_fnumslots; i++) { 579 for (i = 0; i < ses->se_fchannel.maxreqs; i++) {
578 struct nfsd4_cache_entry *e = &ses->se_slots[i].sl_cache_entry; 580 struct nfsd4_cache_entry *e = &ses->se_slots[i].sl_cache_entry;
579 nfsd4_release_respages(e->ce_respages, e->ce_resused); 581 nfsd4_release_respages(e->ce_respages, e->ce_resused);
580 } 582 }
@@ -1130,7 +1132,7 @@ nfsd4_replay_cache_entry(struct nfsd4_compoundres *resp,
1130 * is sent (lease renewal). 1132 * is sent (lease renewal).
1131 */ 1133 */
1132 if (seq && nfsd4_not_cached(resp)) { 1134 if (seq && nfsd4_not_cached(resp)) {
1133 seq->maxslots = resp->cstate.session->se_fnumslots; 1135 seq->maxslots = resp->cstate.session->se_fchannel.maxreqs;
1134 return nfs_ok; 1136 return nfs_ok;
1135 } 1137 }
1136 1138
@@ -1473,7 +1475,7 @@ nfsd4_sequence(struct svc_rqst *rqstp,
1473 goto out; 1475 goto out;
1474 1476
1475 status = nfserr_badslot; 1477 status = nfserr_badslot;
1476 if (seq->slotid >= session->se_fnumslots) 1478 if (seq->slotid >= session->se_fchannel.maxreqs)
1477 goto out; 1479 goto out;
1478 1480
1479 slot = &session->se_slots[seq->slotid]; 1481 slot = &session->se_slots[seq->slotid];
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index d07f704a2ac9..2dcc7feaa6ff 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -3183,7 +3183,7 @@ static int nfsd4_check_drc_limit(struct nfsd4_compoundres *resp)
3183 dprintk("%s length %u, xb->page_len %u tlen %u pad %u\n", __func__, 3183 dprintk("%s length %u, xb->page_len %u tlen %u pad %u\n", __func__,
3184 length, xb->page_len, tlen, pad); 3184 length, xb->page_len, tlen, pad);
3185 3185
3186 if (length <= session->se_fmaxresp_cached) 3186 if (length <= session->se_fchannel.maxresp_cached)
3187 return status; 3187 return status;
3188 else 3188 else
3189 return nfserr_rep_too_big_to_cache; 3189 return nfserr_rep_too_big_to_cache;