aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/nfs4state.c13
-rw-r--r--fs/nfsd/nfs4xdr.c5
-rw-r--r--fs/nfsd/state.h7
-rw-r--r--fs/nfsd/xdr4.h3
4 files changed, 14 insertions, 14 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 2095dbb2923e..e0e706f8918d 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1374,15 +1374,12 @@ nfsd4_enc_sequence_replay(struct nfsd4_compoundargs *args,
1374 struct nfsd4_op *op; 1374 struct nfsd4_op *op;
1375 struct nfsd4_slot *slot = resp->cstate.slot; 1375 struct nfsd4_slot *slot = resp->cstate.slot;
1376 1376
1377 dprintk("--> %s resp->opcnt %d cachethis %u \n", __func__,
1378 resp->opcnt, resp->cstate.slot->sl_cachethis);
1379
1380 /* Encode the replayed sequence operation */ 1377 /* Encode the replayed sequence operation */
1381 op = &args->ops[resp->opcnt - 1]; 1378 op = &args->ops[resp->opcnt - 1];
1382 nfsd4_encode_operation(resp, op); 1379 nfsd4_encode_operation(resp, op);
1383 1380
1384 /* Return nfserr_retry_uncached_rep in next operation. */ 1381 /* Return nfserr_retry_uncached_rep in next operation. */
1385 if (args->opcnt > 1 && slot->sl_cachethis == 0) { 1382 if (args->opcnt > 1 && !(slot->sl_flags & NFSD4_SLOT_CACHETHIS)) {
1386 op = &args->ops[resp->opcnt++]; 1383 op = &args->ops[resp->opcnt++];
1387 op->status = nfserr_retry_uncached_rep; 1384 op->status = nfserr_retry_uncached_rep;
1388 nfsd4_encode_operation(resp, op); 1385 nfsd4_encode_operation(resp, op);
@@ -1916,7 +1913,8 @@ nfsd4_sequence(struct svc_rqst *rqstp,
1916 * sr_highest_slotid and the sr_target_slot id to maxslots */ 1913 * sr_highest_slotid and the sr_target_slot id to maxslots */
1917 seq->maxslots = session->se_fchannel.maxreqs; 1914 seq->maxslots = session->se_fchannel.maxreqs;
1918 1915
1919 status = check_slot_seqid(seq->seqid, slot->sl_seqid, slot->sl_inuse); 1916 status = check_slot_seqid(seq->seqid, slot->sl_seqid,
1917 slot->sl_flags & NFSD4_SLOT_INUSE);
1920 if (status == nfserr_replay_cache) { 1918 if (status == nfserr_replay_cache) {
1921 cstate->slot = slot; 1919 cstate->slot = slot;
1922 cstate->session = session; 1920 cstate->session = session;
@@ -1933,9 +1931,10 @@ nfsd4_sequence(struct svc_rqst *rqstp,
1933 conn = NULL; 1931 conn = NULL;
1934 1932
1935 /* Success! bump slot seqid */ 1933 /* Success! bump slot seqid */
1936 slot->sl_inuse = true;
1937 slot->sl_seqid = seq->seqid; 1934 slot->sl_seqid = seq->seqid;
1938 slot->sl_cachethis = seq->cachethis; 1935 slot->sl_flags = NFSD4_SLOT_INUSE;
1936 if (seq->cachethis)
1937 slot->sl_flags |= NFSD4_SLOT_CACHETHIS;
1939 1938
1940 cstate->slot = slot; 1939 cstate->slot = slot;
1941 cstate->session = session; 1940 cstate->session = session;
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 0ec5a1b9700e..279a70548e47 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -3532,7 +3532,7 @@ int nfsd4_check_resp_size(struct nfsd4_compoundres *resp, u32 pad)
3532 if (length > session->se_fchannel.maxresp_sz) 3532 if (length > session->se_fchannel.maxresp_sz)
3533 return nfserr_rep_too_big; 3533 return nfserr_rep_too_big;
3534 3534
3535 if (slot->sl_cachethis == 1 && 3535 if ((slot->sl_flags & NFSD4_SLOT_CACHETHIS) &&
3536 length > session->se_fchannel.maxresp_cached) 3536 length > session->se_fchannel.maxresp_cached)
3537 return nfserr_rep_too_big_to_cache; 3537 return nfserr_rep_too_big_to_cache;
3538 3538
@@ -3656,8 +3656,7 @@ nfs4svc_encode_compoundres(struct svc_rqst *rqstp, __be32 *p, struct nfsd4_compo
3656 if (nfsd4_has_session(cs)) { 3656 if (nfsd4_has_session(cs)) {
3657 if (cs->status != nfserr_replay_cache) { 3657 if (cs->status != nfserr_replay_cache) {
3658 nfsd4_store_cache_entry(resp); 3658 nfsd4_store_cache_entry(resp);
3659 dprintk("%s: SET SLOT STATE TO AVAILABLE\n", __func__); 3659 cs->slot->sl_flags &= ~NFSD4_SLOT_INUSE;
3660 cs->slot->sl_inuse = false;
3661 } 3660 }
3662 /* Renew the clientid on success and on replay */ 3661 /* Renew the clientid on success and on replay */
3663 release_session_client(cs->session); 3662 release_session_client(cs->session);
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h
index ffb5df1db94f..122217fe9155 100644
--- a/fs/nfsd/state.h
+++ b/fs/nfsd/state.h
@@ -128,12 +128,13 @@ static inline struct nfs4_delegation *delegstateid(struct nfs4_stid *s)
128 (NFSD_CACHE_SIZE_SLOTS_PER_SESSION * NFSD_SLOT_CACHE_SIZE) 128 (NFSD_CACHE_SIZE_SLOTS_PER_SESSION * NFSD_SLOT_CACHE_SIZE)
129 129
130struct nfsd4_slot { 130struct nfsd4_slot {
131 bool sl_inuse;
132 bool sl_cachethis;
133 u16 sl_opcnt;
134 u32 sl_seqid; 131 u32 sl_seqid;
135 __be32 sl_status; 132 __be32 sl_status;
136 u32 sl_datalen; 133 u32 sl_datalen;
134 u16 sl_opcnt;
135#define NFSD4_SLOT_INUSE (1 << 0)
136#define NFSD4_SLOT_CACHETHIS (1 << 1)
137 u8 sl_flags;
137 char sl_data[]; 138 char sl_data[];
138}; 139};
139 140
diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h
index 2364747ee97d..21dccdfcb7a6 100644
--- a/fs/nfsd/xdr4.h
+++ b/fs/nfsd/xdr4.h
@@ -503,7 +503,8 @@ static inline bool nfsd4_is_solo_sequence(struct nfsd4_compoundres *resp)
503 503
504static inline bool nfsd4_not_cached(struct nfsd4_compoundres *resp) 504static inline bool nfsd4_not_cached(struct nfsd4_compoundres *resp)
505{ 505{
506 return !resp->cstate.slot->sl_cachethis || nfsd4_is_solo_sequence(resp); 506 return !(resp->cstate.slot->sl_flags & NFSD4_SLOT_CACHETHIS)
507 || nfsd4_is_solo_sequence(resp);
507} 508}
508 509
509#define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs) 510#define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs)