diff options
author | Benny Halevy <bhalevy@panasas.com> | 2009-04-03 01:28:38 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2009-04-03 20:41:19 -0400 |
commit | e10e0cfc2f27364c73b28adbd3c8688d97049e73 (patch) | |
tree | bc674e4140ea34b7893c14425ad43a930655743c /fs | |
parent | bf864a31d50e3e94d6e76537b97d664913906ff8 (diff) |
nfsd41: destroy_session operation
Implement the destory_session operation confoming to
http://tools.ietf.org/html/draft-ietf-nfsv4-minorversion1-26
[use sessionid_lock spin lock]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfsd/nfs4state.c | 29 | ||||
-rw-r--r-- | fs/nfsd/nfs4xdr.c | 7 |
2 files changed, 33 insertions, 3 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 04a395fb5dce..9192e5b35f42 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -1422,7 +1422,34 @@ nfsd4_destroy_session(struct svc_rqst *r, | |||
1422 | struct nfsd4_compound_state *cstate, | 1422 | struct nfsd4_compound_state *cstate, |
1423 | struct nfsd4_destroy_session *sessionid) | 1423 | struct nfsd4_destroy_session *sessionid) |
1424 | { | 1424 | { |
1425 | return -1; /* stub */ | 1425 | struct nfsd4_session *ses; |
1426 | u32 status = nfserr_badsession; | ||
1427 | |||
1428 | /* Notes: | ||
1429 | * - The confirmed nfs4_client->cl_sessionid holds destroyed sessinid | ||
1430 | * - Should we return nfserr_back_chan_busy if waiting for | ||
1431 | * callbacks on to-be-destroyed session? | ||
1432 | * - Do we need to clear any callback info from previous session? | ||
1433 | */ | ||
1434 | |||
1435 | dump_sessionid(__func__, &sessionid->sessionid); | ||
1436 | spin_lock(&sessionid_lock); | ||
1437 | ses = find_in_sessionid_hashtbl(&sessionid->sessionid); | ||
1438 | if (!ses) { | ||
1439 | spin_unlock(&sessionid_lock); | ||
1440 | goto out; | ||
1441 | } | ||
1442 | |||
1443 | unhash_session(ses); | ||
1444 | spin_unlock(&sessionid_lock); | ||
1445 | |||
1446 | /* wait for callbacks */ | ||
1447 | shutdown_callback_client(ses->se_client); | ||
1448 | nfsd4_put_session(ses); | ||
1449 | status = nfs_ok; | ||
1450 | out: | ||
1451 | dprintk("%s returns %d\n", __func__, ntohl(status)); | ||
1452 | return status; | ||
1426 | } | 1453 | } |
1427 | 1454 | ||
1428 | __be32 | 1455 | __be32 |
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 64bc2150a6fa..c6a726d04efd 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -1207,7 +1207,11 @@ static __be32 | |||
1207 | nfsd4_decode_destroy_session(struct nfsd4_compoundargs *argp, | 1207 | nfsd4_decode_destroy_session(struct nfsd4_compoundargs *argp, |
1208 | struct nfsd4_destroy_session *destroy_session) | 1208 | struct nfsd4_destroy_session *destroy_session) |
1209 | { | 1209 | { |
1210 | return nfserr_opnotsupp; /* stub */ | 1210 | DECODE_HEAD; |
1211 | READ_BUF(NFS4_MAX_SESSIONID_LEN); | ||
1212 | COPYMEM(destroy_session->sessionid.data, NFS4_MAX_SESSIONID_LEN); | ||
1213 | |||
1214 | DECODE_TAIL; | ||
1211 | } | 1215 | } |
1212 | 1216 | ||
1213 | static __be32 | 1217 | static __be32 |
@@ -2971,7 +2975,6 @@ static __be32 | |||
2971 | nfsd4_encode_destroy_session(struct nfsd4_compoundres *resp, int nfserr, | 2975 | nfsd4_encode_destroy_session(struct nfsd4_compoundres *resp, int nfserr, |
2972 | struct nfsd4_destroy_session *destroy_session) | 2976 | struct nfsd4_destroy_session *destroy_session) |
2973 | { | 2977 | { |
2974 | /* stub */ | ||
2975 | return nfserr; | 2978 | return nfserr; |
2976 | } | 2979 | } |
2977 | 2980 | ||