Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 153698
b: refs/heads/master
c: 6c18ba9
h: refs/heads/master
v: v3
  • Loading branch information
Alexandros Batsakis authored and J. Bruce Fields committed Jun 16, 2009
1 parent 52e6fdc commit e64cb4e
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 31 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b9081d90f5b989cd927052084b16b4f950c8c8d7
refs/heads/master: 6c18ba9f5e506b8115b89b1aa7bdc25178f40b0a
28 changes: 15 additions & 13 deletions trunk/fs/nfsd/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,8 @@ static int set_forechannel_maxreqs(struct nfsd4_channel_attrs *fchan)
* fchan holds the client values on input, and the server values on output
*/
static int init_forechannel_attrs(struct svc_rqst *rqstp,
struct nfsd4_session *session,
struct nfsd4_channel_attrs *fchan)
struct nfsd4_channel_attrs *session_fchan,
struct nfsd4_channel_attrs *fchan)
{
int status = 0;
__u32 maxcount = svc_max_payload(rqstp);
Expand All @@ -455,21 +455,21 @@ static int init_forechannel_attrs(struct svc_rqst *rqstp,
/* Use the client's max request and max response size if possible */
if (fchan->maxreq_sz > maxcount)
fchan->maxreq_sz = maxcount;
session->se_fmaxreq_sz = fchan->maxreq_sz;
session_fchan->maxreq_sz = fchan->maxreq_sz;

if (fchan->maxresp_sz > maxcount)
fchan->maxresp_sz = maxcount;
session->se_fmaxresp_sz = fchan->maxresp_sz;
session_fchan->maxresp_sz = fchan->maxresp_sz;

/* Set the max response cached size our default which is
* a multiple of PAGE_SIZE and small */
session->se_fmaxresp_cached = NFSD_PAGES_PER_SLOT * PAGE_SIZE;
fchan->maxresp_cached = session->se_fmaxresp_cached;
session_fchan->maxresp_cached = NFSD_PAGES_PER_SLOT * PAGE_SIZE;
fchan->maxresp_cached = session_fchan->maxresp_cached;

/* Use the client's maxops if possible */
if (fchan->maxops > NFSD_MAX_OPS_PER_COMPOUND)
fchan->maxops = NFSD_MAX_OPS_PER_COMPOUND;
session->se_fmaxops = fchan->maxops;
session_fchan->maxops = fchan->maxops;

/* try to use the client requested number of slots */
if (fchan->maxreqs > NFSD_MAX_SLOTS_PER_SESSION)
Expand All @@ -481,7 +481,7 @@ static int init_forechannel_attrs(struct svc_rqst *rqstp,
*/
status = set_forechannel_maxreqs(fchan);

session->se_fnumslots = fchan->maxreqs;
session_fchan->maxreqs = fchan->maxreqs;
return status;
}

Expand All @@ -495,12 +495,14 @@ alloc_init_session(struct svc_rqst *rqstp, struct nfs4_client *clp,
memset(&tmp, 0, sizeof(tmp));

/* FIXME: For now, we just accept the client back channel attributes. */
status = init_forechannel_attrs(rqstp, &tmp, &cses->fore_channel);
tmp.se_bchannel = cses->back_channel;
status = init_forechannel_attrs(rqstp, &tmp.se_fchannel,
&cses->fore_channel);
if (status)
goto out;

/* allocate struct nfsd4_session and slot table in one piece */
slotsize = tmp.se_fnumslots * sizeof(struct nfsd4_slot);
slotsize = tmp.se_fchannel.maxreqs * sizeof(struct nfsd4_slot);
new = kzalloc(sizeof(*new) + slotsize, GFP_KERNEL);
if (!new)
goto out;
Expand Down Expand Up @@ -574,7 +576,7 @@ free_session(struct kref *kref)
int i;

ses = container_of(kref, struct nfsd4_session, se_ref);
for (i = 0; i < ses->se_fnumslots; i++) {
for (i = 0; i < ses->se_fchannel.maxreqs; i++) {
struct nfsd4_cache_entry *e = &ses->se_slots[i].sl_cache_entry;
nfsd4_release_respages(e->ce_respages, e->ce_resused);
}
Expand Down Expand Up @@ -1130,7 +1132,7 @@ nfsd4_replay_cache_entry(struct nfsd4_compoundres *resp,
* is sent (lease renewal).
*/
if (seq && nfsd4_not_cached(resp)) {
seq->maxslots = resp->cstate.session->se_fnumslots;
seq->maxslots = resp->cstate.session->se_fchannel.maxreqs;
return nfs_ok;
}

Expand Down Expand Up @@ -1473,7 +1475,7 @@ nfsd4_sequence(struct svc_rqst *rqstp,
goto out;

status = nfserr_badslot;
if (seq->slotid >= session->se_fnumslots)
if (seq->slotid >= session->se_fchannel.maxreqs)
goto out;

slot = &session->se_slots[seq->slotid];
Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/nfsd/nfs4xdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -3183,7 +3183,7 @@ static int nfsd4_check_drc_limit(struct nfsd4_compoundres *resp)
dprintk("%s length %u, xb->page_len %u tlen %u pad %u\n", __func__,
length, xb->page_len, tlen, pad);

if (length <= session->se_fmaxresp_cached)
if (length <= session->se_fchannel.maxresp_cached)
return status;
else
return nfserr_rep_too_big_to_cache;
Expand Down
18 changes: 13 additions & 5 deletions trunk/include/linux/nfsd/state.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,18 +115,26 @@ struct nfsd4_slot {
struct nfsd4_cache_entry sl_cache_entry;
};

struct nfsd4_channel_attrs {
u32 headerpadsz;
u32 maxreq_sz;
u32 maxresp_sz;
u32 maxresp_cached;
u32 maxops;
u32 maxreqs;
u32 nr_rdma_attrs;
u32 rdma_attrs;
};

struct nfsd4_session {
struct kref se_ref;
struct list_head se_hash; /* hash by sessionid */
struct list_head se_perclnt;
u32 se_flags;
struct nfs4_client *se_client; /* for expire_client */
struct nfs4_sessionid se_sessionid;
u32 se_fmaxreq_sz;
u32 se_fmaxresp_sz;
u32 se_fmaxresp_cached;
u32 se_fmaxops;
u32 se_fnumslots;
struct nfsd4_channel_attrs se_fchannel;
struct nfsd4_channel_attrs se_bchannel;
struct nfsd4_slot se_slots[]; /* forward channel slots */
};

Expand Down
11 changes: 0 additions & 11 deletions trunk/include/linux/nfsd/xdr4.h
Original file line number Diff line number Diff line change
Expand Up @@ -366,17 +366,6 @@ struct nfsd4_exchange_id {
int spa_how;
};

struct nfsd4_channel_attrs {
u32 headerpadsz;
u32 maxreq_sz;
u32 maxresp_sz;
u32 maxresp_cached;
u32 maxops;
u32 maxreqs;
u32 nr_rdma_attrs;
u32 rdma_attrs;
};

struct nfsd4_create_session {
clientid_t clientid;
struct nfs4_sessionid sessionid;
Expand Down

0 comments on commit e64cb4e

Please sign in to comment.