aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4xdr.c
diff options
context:
space:
mode:
authorAndy Adamson <andros@netapp.com>2009-04-01 09:22:34 -0400
committerBenny Halevy <bhalevy@panasas.com>2009-06-17 15:24:55 -0400
commit0f3e66c6a6cae479028d31198288e524fe5ff90d (patch)
treee221fc927077a22485d5befc0136f1e77ecc55c5 /fs/nfs/nfs4xdr.c
parent96b09e024fedf0a6604c8c688a3994d5ed991434 (diff)
nfs41: destroy_session operation
Implement the destroy_session operation conforming to http://tools.ietf.org/html/draft-ietf-nfsv4-minorversion1-26 Signed-off-by: Ricardo Labiaga <ricardo.labiaga@netapp.com> Signed-off-by: Andy Adamson<andros@umich.edu> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: remove extraneous rpc_clnt pointer] Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41; NFS_CS_READY required for DESTROY_SESSION] Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: pass *session in seq_args and seq_res] Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> [nfs41: fix encode_destroy_session's xdr Xcoding pointer type] Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Diffstat (limited to 'fs/nfs/nfs4xdr.c')
-rw-r--r--fs/nfs/nfs4xdr.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 7a243a2cf0be..a81e49648ccb 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -294,6 +294,8 @@ static int nfs4_stat_to_errno(int);
294 1 /* csr_flags */ + \ 294 1 /* csr_flags */ + \
295 decode_channel_attrs_maxsz + \ 295 decode_channel_attrs_maxsz + \
296 decode_channel_attrs_maxsz) 296 decode_channel_attrs_maxsz)
297#define encode_destroy_session_maxsz (op_encode_hdr_maxsz + 4)
298#define decode_destroy_session_maxsz (op_decode_hdr_maxsz)
297#define encode_sequence_maxsz 0 /* stub */ 299#define encode_sequence_maxsz 0 /* stub */
298#define decode_sequence_maxsz 0 /* stub */ 300#define decode_sequence_maxsz 0 /* stub */
299#else /* CONFIG_NFS_V4_1 */ 301#else /* CONFIG_NFS_V4_1 */
@@ -655,6 +657,10 @@ static int nfs4_stat_to_errno(int);
655#define NFS4_dec_create_session_sz \ 657#define NFS4_dec_create_session_sz \
656 (compound_decode_hdr_maxsz + \ 658 (compound_decode_hdr_maxsz + \
657 decode_create_session_maxsz) 659 decode_create_session_maxsz)
660#define NFS4_enc_destroy_session_sz (compound_encode_hdr_maxsz + \
661 encode_destroy_session_maxsz)
662#define NFS4_dec_destroy_session_sz (compound_decode_hdr_maxsz + \
663 decode_destroy_session_maxsz)
658#define NFS4_enc_get_lease_time_sz (compound_encode_hdr_maxsz + \ 664#define NFS4_enc_get_lease_time_sz (compound_encode_hdr_maxsz + \
659 encode_sequence_maxsz + \ 665 encode_sequence_maxsz + \
660 encode_putrootfh_maxsz + \ 666 encode_putrootfh_maxsz + \
@@ -1609,6 +1615,18 @@ static void encode_create_session(struct xdr_stream *xdr,
1609 hdr->nops++; 1615 hdr->nops++;
1610 hdr->replen += decode_create_session_maxsz; 1616 hdr->replen += decode_create_session_maxsz;
1611} 1617}
1618
1619static void encode_destroy_session(struct xdr_stream *xdr,
1620 struct nfs4_session *session,
1621 struct compound_hdr *hdr)
1622{
1623 __be32 *p;
1624 RESERVE_SPACE(4 + NFS4_MAX_SESSIONID_LEN);
1625 WRITE32(OP_DESTROY_SESSION);
1626 WRITEMEM(session->sess_id.data, NFS4_MAX_SESSIONID_LEN);
1627 hdr->nops++;
1628 hdr->replen += decode_destroy_session_maxsz;
1629}
1612#endif /* CONFIG_NFS_V4_1 */ 1630#endif /* CONFIG_NFS_V4_1 */
1613 1631
1614static void encode_sequence(struct xdr_stream *xdr, 1632static void encode_sequence(struct xdr_stream *xdr,
@@ -2355,6 +2373,24 @@ static int nfs4_xdr_enc_create_session(struct rpc_rqst *req, uint32_t *p,
2355} 2373}
2356 2374
2357/* 2375/*
2376 * a DESTROY_SESSION request
2377 */
2378static int nfs4_xdr_enc_destroy_session(struct rpc_rqst *req, uint32_t *p,
2379 struct nfs4_session *session)
2380{
2381 struct xdr_stream xdr;
2382 struct compound_hdr hdr = {
2383 .minorversion = session->clp->cl_minorversion,
2384 };
2385
2386 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
2387 encode_compound_hdr(&xdr, req, &hdr);
2388 encode_destroy_session(&xdr, session, &hdr);
2389 encode_nops(&hdr);
2390 return 0;
2391}
2392
2393/*
2358 * a GET_LEASE_TIME request 2394 * a GET_LEASE_TIME request
2359 */ 2395 */
2360static int nfs4_xdr_enc_get_lease_time(struct rpc_rqst *req, uint32_t *p, 2396static int nfs4_xdr_enc_get_lease_time(struct rpc_rqst *req, uint32_t *p,
@@ -4188,6 +4224,11 @@ static int decode_create_session(struct xdr_stream *xdr,
4188 status = decode_chan_attrs(xdr, &session->bc_attrs); 4224 status = decode_chan_attrs(xdr, &session->bc_attrs);
4189 return status; 4225 return status;
4190} 4226}
4227
4228static int decode_destroy_session(struct xdr_stream *xdr, void *dummy)
4229{
4230 return decode_op_hdr(xdr, OP_DESTROY_SESSION);
4231}
4191#endif /* CONFIG_NFS_V4_1 */ 4232#endif /* CONFIG_NFS_V4_1 */
4192 4233
4193static int decode_sequence(struct xdr_stream *xdr, 4234static int decode_sequence(struct xdr_stream *xdr,
@@ -5123,6 +5164,23 @@ static int nfs4_xdr_dec_create_session(struct rpc_rqst *rqstp, uint32_t *p,
5123} 5164}
5124 5165
5125/* 5166/*
5167 * a DESTROY_SESSION request
5168 */
5169static int nfs4_xdr_dec_destroy_session(struct rpc_rqst *rqstp, uint32_t *p,
5170 void *dummy)
5171{
5172 struct xdr_stream xdr;
5173 struct compound_hdr hdr;
5174 int status;
5175
5176 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p);
5177 status = decode_compound_hdr(&xdr, &hdr);
5178 if (!status)
5179 status = decode_destroy_session(&xdr, dummy);
5180 return status;
5181}
5182
5183/*
5126 * a GET_LEASE_TIME request 5184 * a GET_LEASE_TIME request
5127 */ 5185 */
5128static int nfs4_xdr_dec_get_lease_time(struct rpc_rqst *rqstp, uint32_t *p, 5186static int nfs4_xdr_dec_get_lease_time(struct rpc_rqst *rqstp, uint32_t *p,
@@ -5316,6 +5374,7 @@ struct rpc_procinfo nfs4_procedures[] = {
5316#if defined(CONFIG_NFS_V4_1) 5374#if defined(CONFIG_NFS_V4_1)
5317 PROC(EXCHANGE_ID, enc_exchange_id, dec_exchange_id), 5375 PROC(EXCHANGE_ID, enc_exchange_id, dec_exchange_id),
5318 PROC(CREATE_SESSION, enc_create_session, dec_create_session), 5376 PROC(CREATE_SESSION, enc_create_session, dec_create_session),
5377 PROC(DESTROY_SESSION, enc_destroy_session, dec_destroy_session),
5319 PROC(GET_LEASE_TIME, enc_get_lease_time, dec_get_lease_time), 5378 PROC(GET_LEASE_TIME, enc_get_lease_time, dec_get_lease_time),
5320#endif /* CONFIG_NFS_V4_1 */ 5379#endif /* CONFIG_NFS_V4_1 */
5321}; 5380};