diff options
author | Andy Adamson <andros@netapp.com> | 2009-04-01 09:22:30 -0400 |
---|---|---|
committer | Benny Halevy <bhalevy@panasas.com> | 2009-06-17 15:24:32 -0400 |
commit | 2050f0cc0703aab7cee798b3cb47037754f368bc (patch) | |
tree | 48a54e68af8e6fe9b72994013aeecbd812e0e4ea /fs/nfs/nfs4xdr.c | |
parent | 99fe60d062cfecf382c036065b3278b82b6c5eff (diff) |
nfs41: get_lease_time
get_lease_time uses the FSINFO rpc operation to
get the lease time attribute.
nfs4_get_lease_time() is only called from the state manager on session setup
so don't recover from clientid or sequence level errors.
We do need to recover from NFS4ERR_DELAY or NFS4ERR_GRACE.
Use NFS4_POLL_RETRY_MIN - the Linux server returns NFS4ERR_DELAY when an
upcall is needed to resolve an uncached export referenced by a file handle.
[nfs41: sequence res use slotid]
Signed-off-by: Andy Adamson<andros@netapp.com>
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: have get_lease_time work on nfs_client]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
[nfs41: get_lease_time recover from NFS4ERR_DELAY]
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]
[define nfs4_get_lease_time_{args,res}]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4xdr.c')
-rw-r--r-- | fs/nfs/nfs4xdr.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 783c4214dccd..85ee1d17a461 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -622,6 +622,14 @@ static int nfs4_stat_to_errno(int); | |||
622 | #define NFS4_dec_exchange_id_sz \ | 622 | #define NFS4_dec_exchange_id_sz \ |
623 | (compound_decode_hdr_maxsz + \ | 623 | (compound_decode_hdr_maxsz + \ |
624 | decode_exchange_id_maxsz) | 624 | decode_exchange_id_maxsz) |
625 | #define NFS4_enc_get_lease_time_sz (compound_encode_hdr_maxsz + \ | ||
626 | encode_sequence_maxsz + \ | ||
627 | encode_putrootfh_maxsz + \ | ||
628 | encode_fsinfo_maxsz) | ||
629 | #define NFS4_dec_get_lease_time_sz (compound_decode_hdr_maxsz + \ | ||
630 | decode_sequence_maxsz + \ | ||
631 | decode_putrootfh_maxsz + \ | ||
632 | decode_fsinfo_maxsz) | ||
625 | #endif /* CONFIG_NFS_V4_1 */ | 633 | #endif /* CONFIG_NFS_V4_1 */ |
626 | 634 | ||
627 | static const umode_t nfs_type2fmt[] = { | 635 | static const umode_t nfs_type2fmt[] = { |
@@ -2231,6 +2239,27 @@ static int nfs4_xdr_enc_exchange_id(struct rpc_rqst *req, uint32_t *p, | |||
2231 | encode_nops(&hdr); | 2239 | encode_nops(&hdr); |
2232 | return 0; | 2240 | return 0; |
2233 | } | 2241 | } |
2242 | |||
2243 | /* | ||
2244 | * a GET_LEASE_TIME request | ||
2245 | */ | ||
2246 | static int nfs4_xdr_enc_get_lease_time(struct rpc_rqst *req, uint32_t *p, | ||
2247 | struct nfs4_get_lease_time_args *args) | ||
2248 | { | ||
2249 | struct xdr_stream xdr; | ||
2250 | struct compound_hdr hdr = { | ||
2251 | .minorversion = nfs4_xdr_minorversion(&args->la_seq_args), | ||
2252 | }; | ||
2253 | const u32 lease_bitmap[2] = { FATTR4_WORD0_LEASE_TIME, 0 }; | ||
2254 | |||
2255 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
2256 | encode_compound_hdr(&xdr, req, &hdr); | ||
2257 | encode_sequence(&xdr, &args->la_seq_args, &hdr); | ||
2258 | encode_putrootfh(&xdr, &hdr); | ||
2259 | encode_fsinfo(&xdr, lease_bitmap, &hdr); | ||
2260 | encode_nops(&hdr); | ||
2261 | return 0; | ||
2262 | } | ||
2234 | #endif /* CONFIG_NFS_V4_1 */ | 2263 | #endif /* CONFIG_NFS_V4_1 */ |
2235 | 2264 | ||
2236 | /* | 2265 | /* |
@@ -4908,6 +4937,27 @@ static int nfs4_xdr_dec_exchange_id(struct rpc_rqst *rqstp, uint32_t *p, | |||
4908 | status = decode_exchange_id(&xdr, res); | 4937 | status = decode_exchange_id(&xdr, res); |
4909 | return status; | 4938 | return status; |
4910 | } | 4939 | } |
4940 | |||
4941 | /* | ||
4942 | * a GET_LEASE_TIME request | ||
4943 | */ | ||
4944 | static int nfs4_xdr_dec_get_lease_time(struct rpc_rqst *rqstp, uint32_t *p, | ||
4945 | struct nfs4_get_lease_time_res *res) | ||
4946 | { | ||
4947 | struct xdr_stream xdr; | ||
4948 | struct compound_hdr hdr; | ||
4949 | int status; | ||
4950 | |||
4951 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); | ||
4952 | status = decode_compound_hdr(&xdr, &hdr); | ||
4953 | if (!status) | ||
4954 | status = decode_sequence(&xdr, &res->lr_seq_res, rqstp); | ||
4955 | if (!status) | ||
4956 | status = decode_putrootfh(&xdr); | ||
4957 | if (!status) | ||
4958 | status = decode_fsinfo(&xdr, res->lr_fsinfo); | ||
4959 | return status; | ||
4960 | } | ||
4911 | #endif /* CONFIG_NFS_V4_1 */ | 4961 | #endif /* CONFIG_NFS_V4_1 */ |
4912 | 4962 | ||
4913 | __be32 *nfs4_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus) | 4963 | __be32 *nfs4_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus) |
@@ -5081,6 +5131,7 @@ struct rpc_procinfo nfs4_procedures[] = { | |||
5081 | PROC(FS_LOCATIONS, enc_fs_locations, dec_fs_locations), | 5131 | PROC(FS_LOCATIONS, enc_fs_locations, dec_fs_locations), |
5082 | #if defined(CONFIG_NFS_V4_1) | 5132 | #if defined(CONFIG_NFS_V4_1) |
5083 | PROC(EXCHANGE_ID, enc_exchange_id, dec_exchange_id), | 5133 | PROC(EXCHANGE_ID, enc_exchange_id, dec_exchange_id), |
5134 | PROC(GET_LEASE_TIME, enc_get_lease_time, dec_get_lease_time), | ||
5084 | #endif /* CONFIG_NFS_V4_1 */ | 5135 | #endif /* CONFIG_NFS_V4_1 */ |
5085 | }; | 5136 | }; |
5086 | 5137 | ||