aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4xdr.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-07-02 13:57:28 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-07-10 23:40:39 -0400
commit2cebf82883f49fd26148da5d9a43d1b4363f1d59 (patch)
tree0d3b656135a72bc0ef95fa8148767bbdcd9c2146 /fs/nfs/nfs4xdr.c
parentbd625ba80d84d9de003b8a4bf61fd937b82aca09 (diff)
NFSv4: Fix the underestimate of NFSv4 open request size
The maximum size depends on the filename size and a number of other elements which are currently not being counted. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4xdr.c')
-rw-r--r--fs/nfs/nfs4xdr.c63
1 files changed, 45 insertions, 18 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 932bc79a9028..f6068bf3823a 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -70,7 +70,8 @@ static int nfs4_stat_to_errno(int);
70/* lock,open owner id: 70/* lock,open owner id:
71 * we currently use size 1 (u32) out of (NFS4_OPAQUE_LIMIT >> 2) 71 * we currently use size 1 (u32) out of (NFS4_OPAQUE_LIMIT >> 2)
72 */ 72 */
73#define owner_id_maxsz (1 + 1) 73#define open_owner_id_maxsz (1 + 1)
74#define lock_owner_id_maxsz (1 + 1)
74#define compound_encode_hdr_maxsz (3 + (NFS4_MAXTAGLEN >> 2)) 75#define compound_encode_hdr_maxsz (3 + (NFS4_MAXTAGLEN >> 2))
75#define compound_decode_hdr_maxsz (3 + (NFS4_MAXTAGLEN >> 2)) 76#define compound_decode_hdr_maxsz (3 + (NFS4_MAXTAGLEN >> 2))
76#define op_encode_hdr_maxsz (1) 77#define op_encode_hdr_maxsz (1)
@@ -120,6 +121,25 @@ static int nfs4_stat_to_errno(int);
120 (op_decode_hdr_maxsz) 121 (op_decode_hdr_maxsz)
121#define encode_lookup_maxsz (op_encode_hdr_maxsz + \ 122#define encode_lookup_maxsz (op_encode_hdr_maxsz + \
122 1 + ((3 + NFS4_FHSIZE) >> 2)) 123 1 + ((3 + NFS4_FHSIZE) >> 2))
124#define encode_share_access_maxsz \
125 (2)
126#define encode_createmode_maxsz (1 + nfs4_fattr_maxsz)
127#define encode_opentype_maxsz (1 + encode_createmode_maxsz)
128#define encode_claim_null_maxsz (1 + nfs4_name_maxsz)
129#define encode_open_maxsz (op_encode_hdr_maxsz + \
130 2 + encode_share_access_maxsz + 2 + \
131 open_owner_id_maxsz + \
132 encode_opentype_maxsz + \
133 encode_claim_null_maxsz)
134#define decode_ace_maxsz (3 + nfs4_owner_maxsz)
135#define decode_delegation_maxsz (1 + XDR_QUADLEN(NFS4_STATEID_SIZE) + 1 + \
136 decode_ace_maxsz)
137#define decode_change_info_maxsz (5)
138#define decode_open_maxsz (op_decode_hdr_maxsz + \
139 XDR_QUADLEN(NFS4_STATEID_SIZE) + \
140 decode_change_info_maxsz + 1 + \
141 nfs4_fattr_bitmap_maxsz + \
142 decode_delegation_maxsz)
123#define encode_remove_maxsz (op_encode_hdr_maxsz + \ 143#define encode_remove_maxsz (op_encode_hdr_maxsz + \
124 nfs4_name_maxsz) 144 nfs4_name_maxsz)
125#define encode_rename_maxsz (op_encode_hdr_maxsz + \ 145#define encode_rename_maxsz (op_encode_hdr_maxsz + \
@@ -136,7 +156,9 @@ static int nfs4_stat_to_errno(int);
136#define encode_create_maxsz (op_encode_hdr_maxsz + \ 156#define encode_create_maxsz (op_encode_hdr_maxsz + \
137 2 + nfs4_name_maxsz + \ 157 2 + nfs4_name_maxsz + \
138 nfs4_fattr_maxsz) 158 nfs4_fattr_maxsz)
139#define decode_create_maxsz (op_decode_hdr_maxsz + 8) 159#define decode_create_maxsz (op_decode_hdr_maxsz + \
160 decode_change_info_maxsz + \
161 nfs4_fattr_bitmap_maxsz)
140#define encode_delegreturn_maxsz (op_encode_hdr_maxsz + 4) 162#define encode_delegreturn_maxsz (op_encode_hdr_maxsz + 4)
141#define decode_delegreturn_maxsz (op_decode_hdr_maxsz) 163#define decode_delegreturn_maxsz (op_decode_hdr_maxsz)
142#define NFS4_enc_compound_sz (1024) /* XXX: large enough? */ 164#define NFS4_enc_compound_sz (1024) /* XXX: large enough? */
@@ -176,16 +198,21 @@ static int nfs4_stat_to_errno(int);
176 op_decode_hdr_maxsz + 2 + \ 198 op_decode_hdr_maxsz + 2 + \
177 decode_getattr_maxsz) 199 decode_getattr_maxsz)
178#define NFS4_enc_open_sz (compound_encode_hdr_maxsz + \ 200#define NFS4_enc_open_sz (compound_encode_hdr_maxsz + \
179 encode_putfh_maxsz + \ 201 encode_putfh_maxsz + \
180 op_encode_hdr_maxsz + \ 202 encode_savefh_maxsz + \
181 13 + 3 + 2 + 64 + \ 203 encode_open_maxsz + \
182 encode_getattr_maxsz + \ 204 encode_getfh_maxsz + \
183 encode_getfh_maxsz) 205 encode_getattr_maxsz + \
206 encode_restorefh_maxsz + \
207 encode_getattr_maxsz)
184#define NFS4_dec_open_sz (compound_decode_hdr_maxsz + \ 208#define NFS4_dec_open_sz (compound_decode_hdr_maxsz + \
185 decode_putfh_maxsz + \ 209 decode_putfh_maxsz + \
186 op_decode_hdr_maxsz + 4 + 5 + 2 + 3 + \ 210 decode_savefh_maxsz + \
187 decode_getattr_maxsz + \ 211 decode_open_maxsz + \
188 decode_getfh_maxsz) 212 decode_getfh_maxsz + \
213 decode_getattr_maxsz + \
214 decode_restorefh_maxsz + \
215 decode_getattr_maxsz)
189#define NFS4_enc_open_confirm_sz \ 216#define NFS4_enc_open_confirm_sz \
190 (compound_encode_hdr_maxsz + \ 217 (compound_encode_hdr_maxsz + \
191 encode_putfh_maxsz + \ 218 encode_putfh_maxsz + \
@@ -195,12 +222,12 @@ static int nfs4_stat_to_errno(int);
195 op_decode_hdr_maxsz + 4) 222 op_decode_hdr_maxsz + 4)
196#define NFS4_enc_open_noattr_sz (compound_encode_hdr_maxsz + \ 223#define NFS4_enc_open_noattr_sz (compound_encode_hdr_maxsz + \
197 encode_putfh_maxsz + \ 224 encode_putfh_maxsz + \
198 op_encode_hdr_maxsz + \ 225 encode_open_maxsz + \
199 11) 226 encode_getattr_maxsz)
200#define NFS4_dec_open_noattr_sz (compound_decode_hdr_maxsz + \ 227#define NFS4_dec_open_noattr_sz (compound_decode_hdr_maxsz + \
201 decode_putfh_maxsz + \ 228 decode_putfh_maxsz + \
202 op_decode_hdr_maxsz + \ 229 decode_open_maxsz + \
203 4 + 5 + 2 + 3) 230 decode_getattr_maxsz)
204#define NFS4_enc_open_downgrade_sz \ 231#define NFS4_enc_open_downgrade_sz \
205 (compound_encode_hdr_maxsz + \ 232 (compound_encode_hdr_maxsz + \
206 encode_putfh_maxsz + \ 233 encode_putfh_maxsz + \
@@ -258,19 +285,19 @@ static int nfs4_stat_to_errno(int);
258 op_encode_hdr_maxsz + \ 285 op_encode_hdr_maxsz + \
259 1 + 1 + 2 + 2 + \ 286 1 + 1 + 2 + 2 + \
260 1 + 4 + 1 + 2 + \ 287 1 + 4 + 1 + 2 + \
261 owner_id_maxsz) 288 lock_owner_id_maxsz)
262#define NFS4_dec_lock_sz (compound_decode_hdr_maxsz + \ 289#define NFS4_dec_lock_sz (compound_decode_hdr_maxsz + \
263 decode_putfh_maxsz + \ 290 decode_putfh_maxsz + \
264 decode_getattr_maxsz + \ 291 decode_getattr_maxsz + \
265 op_decode_hdr_maxsz + \ 292 op_decode_hdr_maxsz + \
266 2 + 2 + 1 + 2 + \ 293 2 + 2 + 1 + 2 + \
267 owner_id_maxsz) 294 lock_owner_id_maxsz)
268#define NFS4_enc_lockt_sz (compound_encode_hdr_maxsz + \ 295#define NFS4_enc_lockt_sz (compound_encode_hdr_maxsz + \
269 encode_putfh_maxsz + \ 296 encode_putfh_maxsz + \
270 encode_getattr_maxsz + \ 297 encode_getattr_maxsz + \
271 op_encode_hdr_maxsz + \ 298 op_encode_hdr_maxsz + \
272 1 + 2 + 2 + 2 + \ 299 1 + 2 + 2 + 2 + \
273 owner_id_maxsz) 300 lock_owner_id_maxsz)
274#define NFS4_dec_lockt_sz (NFS4_dec_lock_sz) 301#define NFS4_dec_lockt_sz (NFS4_dec_lock_sz)
275#define NFS4_enc_locku_sz (compound_encode_hdr_maxsz + \ 302#define NFS4_enc_locku_sz (compound_encode_hdr_maxsz + \
276 encode_putfh_maxsz + \ 303 encode_putfh_maxsz + \