|
@@ -653,8 +653,6 @@ static inline void
|
|
free_client(struct nfs4_client *clp)
|
|
free_client(struct nfs4_client *clp)
|
|
{
|
|
{
|
|
shutdown_callback_client(clp);
|
|
shutdown_callback_client(clp);
|
|
- nfsd4_release_respages(clp->cl_slot.sl_cache_entry.ce_respages,
|
|
|
|
- clp->cl_slot.sl_cache_entry.ce_resused);
|
|
|
|
if (clp->cl_cred.cr_group_info)
|
|
if (clp->cl_cred.cr_group_info)
|
|
put_group_info(clp->cl_cred.cr_group_info);
|
|
put_group_info(clp->cl_cred.cr_group_info);
|
|
kfree(clp->cl_principal);
|
|
kfree(clp->cl_principal);
|
|
@@ -1293,12 +1291,11 @@ out_copy:
|
|
exid->clientid.cl_boot = new->cl_clientid.cl_boot;
|
|
exid->clientid.cl_boot = new->cl_clientid.cl_boot;
|
|
exid->clientid.cl_id = new->cl_clientid.cl_id;
|
|
exid->clientid.cl_id = new->cl_clientid.cl_id;
|
|
|
|
|
|
- new->cl_slot.sl_seqid = 0;
|
|
|
|
exid->seqid = 1;
|
|
exid->seqid = 1;
|
|
nfsd4_set_ex_flags(new, exid);
|
|
nfsd4_set_ex_flags(new, exid);
|
|
|
|
|
|
dprintk("nfsd4_exchange_id seqid %d flags %x\n",
|
|
dprintk("nfsd4_exchange_id seqid %d flags %x\n",
|
|
- new->cl_slot.sl_seqid, new->cl_exchange_flags);
|
|
|
|
|
|
+ new->cl_cs_slot.sl_seqid, new->cl_exchange_flags);
|
|
status = nfs_ok;
|
|
status = nfs_ok;
|
|
|
|
|
|
out:
|
|
out:
|
|
@@ -1334,15 +1331,35 @@ check_slot_seqid(u32 seqid, u32 slot_seqid, int slot_inuse)
|
|
return nfserr_seq_misordered;
|
|
return nfserr_seq_misordered;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/*
|
|
|
|
+ * Cache the create session result into the create session single DRC
|
|
|
|
+ * slot cache by saving the xdr structure. sl_seqid has been set.
|
|
|
|
+ * Do this for solo or embedded create session operations.
|
|
|
|
+ */
|
|
|
|
+static void
|
|
|
|
+nfsd4_cache_create_session(struct nfsd4_create_session *cr_ses,
|
|
|
|
+ struct nfsd4_clid_slot *slot, int nfserr)
|
|
|
|
+{
|
|
|
|
+ slot->sl_status = nfserr;
|
|
|
|
+ memcpy(&slot->sl_cr_ses, cr_ses, sizeof(*cr_ses));
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static __be32
|
|
|
|
+nfsd4_replay_create_session(struct nfsd4_create_session *cr_ses,
|
|
|
|
+ struct nfsd4_clid_slot *slot)
|
|
|
|
+{
|
|
|
|
+ memcpy(cr_ses, &slot->sl_cr_ses, sizeof(*cr_ses));
|
|
|
|
+ return slot->sl_status;
|
|
|
|
+}
|
|
|
|
+
|
|
__be32
|
|
__be32
|
|
nfsd4_create_session(struct svc_rqst *rqstp,
|
|
nfsd4_create_session(struct svc_rqst *rqstp,
|
|
struct nfsd4_compound_state *cstate,
|
|
struct nfsd4_compound_state *cstate,
|
|
struct nfsd4_create_session *cr_ses)
|
|
struct nfsd4_create_session *cr_ses)
|
|
{
|
|
{
|
|
u32 ip_addr = svc_addr_in(rqstp)->sin_addr.s_addr;
|
|
u32 ip_addr = svc_addr_in(rqstp)->sin_addr.s_addr;
|
|
- struct nfsd4_compoundres *resp = rqstp->rq_resp;
|
|
|
|
struct nfs4_client *conf, *unconf;
|
|
struct nfs4_client *conf, *unconf;
|
|
- struct nfsd4_slot *slot = NULL;
|
|
|
|
|
|
+ struct nfsd4_clid_slot *cs_slot = NULL;
|
|
int status = 0;
|
|
int status = 0;
|
|
|
|
|
|
nfs4_lock_state();
|
|
nfs4_lock_state();
|
|
@@ -1350,25 +1367,22 @@ nfsd4_create_session(struct svc_rqst *rqstp,
|
|
conf = find_confirmed_client(&cr_ses->clientid);
|
|
conf = find_confirmed_client(&cr_ses->clientid);
|
|
|
|
|
|
if (conf) {
|
|
if (conf) {
|
|
- slot = &conf->cl_slot;
|
|
|
|
- status = check_slot_seqid(cr_ses->seqid, slot->sl_seqid,
|
|
|
|
- slot->sl_inuse);
|
|
|
|
|
|
+ cs_slot = &conf->cl_cs_slot;
|
|
|
|
+ status = check_slot_seqid(cr_ses->seqid, cs_slot->sl_seqid, 0);
|
|
if (status == nfserr_replay_cache) {
|
|
if (status == nfserr_replay_cache) {
|
|
dprintk("Got a create_session replay! seqid= %d\n",
|
|
dprintk("Got a create_session replay! seqid= %d\n",
|
|
- slot->sl_seqid);
|
|
|
|
- cstate->slot = slot;
|
|
|
|
- cstate->status = status;
|
|
|
|
|
|
+ cs_slot->sl_seqid);
|
|
/* Return the cached reply status */
|
|
/* Return the cached reply status */
|
|
- status = nfsd4_replay_cache_entry(resp, NULL);
|
|
|
|
|
|
+ status = nfsd4_replay_create_session(cr_ses, cs_slot);
|
|
goto out;
|
|
goto out;
|
|
- } else if (cr_ses->seqid != conf->cl_slot.sl_seqid + 1) {
|
|
|
|
|
|
+ } else if (cr_ses->seqid != cs_slot->sl_seqid + 1) {
|
|
status = nfserr_seq_misordered;
|
|
status = nfserr_seq_misordered;
|
|
dprintk("Sequence misordered!\n");
|
|
dprintk("Sequence misordered!\n");
|
|
dprintk("Expected seqid= %d but got seqid= %d\n",
|
|
dprintk("Expected seqid= %d but got seqid= %d\n",
|
|
- slot->sl_seqid, cr_ses->seqid);
|
|
|
|
|
|
+ cs_slot->sl_seqid, cr_ses->seqid);
|
|
goto out;
|
|
goto out;
|
|
}
|
|
}
|
|
- conf->cl_slot.sl_seqid++;
|
|
|
|
|
|
+ cs_slot->sl_seqid++;
|
|
} else if (unconf) {
|
|
} else if (unconf) {
|
|
if (!same_creds(&unconf->cl_cred, &rqstp->rq_cred) ||
|
|
if (!same_creds(&unconf->cl_cred, &rqstp->rq_cred) ||
|
|
(ip_addr != unconf->cl_addr)) {
|
|
(ip_addr != unconf->cl_addr)) {
|
|
@@ -1376,16 +1390,15 @@ nfsd4_create_session(struct svc_rqst *rqstp,
|
|
goto out;
|
|
goto out;
|
|
}
|
|
}
|
|
|
|
|
|
- slot = &unconf->cl_slot;
|
|
|
|
- status = check_slot_seqid(cr_ses->seqid, slot->sl_seqid,
|
|
|
|
- slot->sl_inuse);
|
|
|
|
|
|
+ cs_slot = &unconf->cl_cs_slot;
|
|
|
|
+ status = check_slot_seqid(cr_ses->seqid, cs_slot->sl_seqid, 0);
|
|
if (status) {
|
|
if (status) {
|
|
/* an unconfirmed replay returns misordered */
|
|
/* an unconfirmed replay returns misordered */
|
|
status = nfserr_seq_misordered;
|
|
status = nfserr_seq_misordered;
|
|
- goto out;
|
|
|
|
|
|
+ goto out_cache;
|
|
}
|
|
}
|
|
|
|
|
|
- slot->sl_seqid++; /* from 0 to 1 */
|
|
|
|
|
|
+ cs_slot->sl_seqid++; /* from 0 to 1 */
|
|
move_to_confirmed(unconf);
|
|
move_to_confirmed(unconf);
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -1406,12 +1419,11 @@ nfsd4_create_session(struct svc_rqst *rqstp,
|
|
|
|
|
|
memcpy(cr_ses->sessionid.data, conf->cl_sessionid.data,
|
|
memcpy(cr_ses->sessionid.data, conf->cl_sessionid.data,
|
|
NFS4_MAX_SESSIONID_LEN);
|
|
NFS4_MAX_SESSIONID_LEN);
|
|
- cr_ses->seqid = slot->sl_seqid;
|
|
|
|
|
|
+ cr_ses->seqid = cs_slot->sl_seqid;
|
|
|
|
|
|
- slot->sl_inuse = true;
|
|
|
|
- cstate->slot = slot;
|
|
|
|
- /* Ensure a page is used for the cache */
|
|
|
|
- slot->sl_cache_entry.ce_cachethis = 1;
|
|
|
|
|
|
+out_cache:
|
|
|
|
+ /* cache solo and embedded create sessions under the state lock */
|
|
|
|
+ nfsd4_cache_create_session(cr_ses, cs_slot, status);
|
|
out:
|
|
out:
|
|
nfs4_unlock_state();
|
|
nfs4_unlock_state();
|
|
dprintk("%s returns %d\n", __func__, ntohl(status));
|
|
dprintk("%s returns %d\n", __func__, ntohl(status));
|