diff options
author | Alexandros Batsakis <batsakis@netapp.com> | 2009-12-05 13:36:55 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-12-05 13:36:55 -0500 |
commit | 2449ea2e191123729b2dc37a06fcb9d6ea7e2736 (patch) | |
tree | f5b71099baefb6c550511b3d5f3da26b8c384454 | |
parent | 7b183d0d432ab3525ae29511a5348ead3e790620 (diff) |
nfs41: V2 adjust max_rqst_sz, max_resp_sz w.r.t to rsize, wsize
The v4.1 client should take into account the desired rsize, wsize when
negotiating the max size in CREATE_SESSION. Accordingly, it should use
rsize, wsize that are smaller than the session negotiated values.
Signed-off-by: Alexandros Batsakis <batsakis@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | fs/nfs/client.c | 14 | ||||
-rw-r--r-- | fs/nfs/internal.h | 4 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 7 | ||||
-rw-r--r-- | fs/nfs/nfs4xdr.c | 14 |
4 files changed, 35 insertions, 4 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 99ea196f071f..ee77713ce68b 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -1260,10 +1260,20 @@ error: | |||
1260 | static void nfs4_session_set_rwsize(struct nfs_server *server) | 1260 | static void nfs4_session_set_rwsize(struct nfs_server *server) |
1261 | { | 1261 | { |
1262 | #ifdef CONFIG_NFS_V4_1 | 1262 | #ifdef CONFIG_NFS_V4_1 |
1263 | struct nfs4_session *sess; | ||
1264 | u32 server_resp_sz; | ||
1265 | u32 server_rqst_sz; | ||
1266 | |||
1263 | if (!nfs4_has_session(server->nfs_client)) | 1267 | if (!nfs4_has_session(server->nfs_client)) |
1264 | return; | 1268 | return; |
1265 | server->rsize = server->nfs_client->cl_session->fc_attrs.max_resp_sz; | 1269 | sess = server->nfs_client->cl_session; |
1266 | server->wsize = server->nfs_client->cl_session->fc_attrs.max_rqst_sz; | 1270 | server_resp_sz = sess->fc_attrs.max_resp_sz - nfs41_maxread_overhead; |
1271 | server_rqst_sz = sess->fc_attrs.max_rqst_sz - nfs41_maxwrite_overhead; | ||
1272 | |||
1273 | if (server->rsize > server_resp_sz) | ||
1274 | server->rsize = server_resp_sz; | ||
1275 | if (server->wsize > server_rqst_sz) | ||
1276 | server->wsize = server_rqst_sz; | ||
1267 | #endif /* CONFIG_NFS_V4_1 */ | 1277 | #endif /* CONFIG_NFS_V4_1 */ |
1268 | } | 1278 | } |
1269 | 1279 | ||
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 7466d24893f7..83a9284b83c7 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h | |||
@@ -191,6 +191,10 @@ extern __be32 *nfs3_decode_dirent(__be32 *, struct nfs_entry *, int); | |||
191 | #ifdef CONFIG_NFS_V4 | 191 | #ifdef CONFIG_NFS_V4 |
192 | extern __be32 *nfs4_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus); | 192 | extern __be32 *nfs4_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus); |
193 | #endif | 193 | #endif |
194 | #ifdef CONFIG_NFS_V4_1 | ||
195 | extern const u32 nfs41_maxread_overhead; | ||
196 | extern const u32 nfs41_maxwrite_overhead; | ||
197 | #endif | ||
194 | 198 | ||
195 | /* nfs4proc.c */ | 199 | /* nfs4proc.c */ |
196 | extern void nfs4_restart_rpc(struct rpc_task *, const struct nfs_client *, | 200 | extern void nfs4_restart_rpc(struct rpc_task *, const struct nfs_client *, |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index dfd1ea99e2d6..d897b9e34f12 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -4862,13 +4862,16 @@ int nfs4_proc_destroy_session(struct nfs4_session *session) | |||
4862 | int nfs4_init_session(struct nfs_server *server) | 4862 | int nfs4_init_session(struct nfs_server *server) |
4863 | { | 4863 | { |
4864 | struct nfs_client *clp = server->nfs_client; | 4864 | struct nfs_client *clp = server->nfs_client; |
4865 | struct nfs4_session *session; | ||
4865 | int ret; | 4866 | int ret; |
4866 | 4867 | ||
4867 | if (!nfs4_has_session(clp)) | 4868 | if (!nfs4_has_session(clp)) |
4868 | return 0; | 4869 | return 0; |
4869 | 4870 | ||
4870 | clp->cl_session->fc_attrs.max_rqst_sz = server->wsize; | 4871 | session = clp->cl_session; |
4871 | clp->cl_session->fc_attrs.max_resp_sz = server->rsize; | 4872 | session->fc_attrs.max_rqst_sz = server->wsize + nfs41_maxwrite_overhead; |
4873 | session->fc_attrs.max_resp_sz = server->rsize + nfs41_maxread_overhead; | ||
4874 | |||
4872 | ret = nfs4_recover_expired_lease(server); | 4875 | ret = nfs4_recover_expired_lease(server); |
4873 | if (!ret) | 4876 | if (!ret) |
4874 | ret = nfs4_check_client_ready(clp); | 4877 | ret = nfs4_check_client_ready(clp); |
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 0b1f3fcdd28a..4ddd04a1113e 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include <linux/proc_fs.h> | 46 | #include <linux/proc_fs.h> |
47 | #include <linux/kdev_t.h> | 47 | #include <linux/kdev_t.h> |
48 | #include <linux/sunrpc/clnt.h> | 48 | #include <linux/sunrpc/clnt.h> |
49 | #include <linux/sunrpc/msg_prot.h> | ||
49 | #include <linux/nfs.h> | 50 | #include <linux/nfs.h> |
50 | #include <linux/nfs4.h> | 51 | #include <linux/nfs4.h> |
51 | #include <linux/nfs_fs.h> | 52 | #include <linux/nfs_fs.h> |
@@ -677,6 +678,19 @@ static int nfs4_stat_to_errno(int); | |||
677 | decode_sequence_maxsz + \ | 678 | decode_sequence_maxsz + \ |
678 | decode_putrootfh_maxsz + \ | 679 | decode_putrootfh_maxsz + \ |
679 | decode_fsinfo_maxsz) | 680 | decode_fsinfo_maxsz) |
681 | |||
682 | const u32 nfs41_maxwrite_overhead = ((RPC_MAX_HEADER_WITH_AUTH + | ||
683 | compound_encode_hdr_maxsz + | ||
684 | encode_sequence_maxsz + | ||
685 | encode_putfh_maxsz + | ||
686 | encode_getattr_maxsz) * | ||
687 | XDR_UNIT); | ||
688 | |||
689 | const u32 nfs41_maxread_overhead = ((RPC_MAX_HEADER_WITH_AUTH + | ||
690 | compound_decode_hdr_maxsz + | ||
691 | decode_sequence_maxsz + | ||
692 | decode_putfh_maxsz) * | ||
693 | XDR_UNIT); | ||
680 | #endif /* CONFIG_NFS_V4_1 */ | 694 | #endif /* CONFIG_NFS_V4_1 */ |
681 | 695 | ||
682 | static const umode_t nfs_type2fmt[] = { | 696 | static const umode_t nfs_type2fmt[] = { |