diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-10-15 11:51:21 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-11-04 14:43:38 -0500 |
commit | 7fc388460e8479c5b3120cb2fcf0e0daec70b93f (patch) | |
tree | eb6445ae11e33658f1c96456e34f0b811d2d83d4 /fs/nfs/nfs3xdr.c | |
parent | 1fea73a86527d7ec463af6ff04b0830e1425ff6c (diff) |
NFS: Remove asserts from the NFS XDR code
Convert the ones that are not trivial to check into WARN_ON_ONCE().
Remove checks for things such as NFS2_MAXPATHLEN, which are trivially
done by the caller.
Add a comment to the case of nfs3_xdr_enc_setacl3args. What is being
done there is just wrong...
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs3xdr.c')
-rw-r--r-- | fs/nfs/nfs3xdr.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c index 6cbe89400df..bffc32406fb 100644 --- a/fs/nfs/nfs3xdr.c +++ b/fs/nfs/nfs3xdr.c | |||
@@ -198,7 +198,7 @@ static void encode_filename3(struct xdr_stream *xdr, | |||
198 | { | 198 | { |
199 | __be32 *p; | 199 | __be32 *p; |
200 | 200 | ||
201 | BUG_ON(length > NFS3_MAXNAMLEN); | 201 | WARN_ON_ONCE(length > NFS3_MAXNAMLEN); |
202 | p = xdr_reserve_space(xdr, 4 + length); | 202 | p = xdr_reserve_space(xdr, 4 + length); |
203 | xdr_encode_opaque(p, name, length); | 203 | xdr_encode_opaque(p, name, length); |
204 | } | 204 | } |
@@ -238,7 +238,6 @@ out_overflow: | |||
238 | static void encode_nfspath3(struct xdr_stream *xdr, struct page **pages, | 238 | static void encode_nfspath3(struct xdr_stream *xdr, struct page **pages, |
239 | const u32 length) | 239 | const u32 length) |
240 | { | 240 | { |
241 | BUG_ON(length > NFS3_MAXPATHLEN); | ||
242 | encode_uint32(xdr, length); | 241 | encode_uint32(xdr, length); |
243 | xdr_write_pages(xdr, pages, 0, length); | 242 | xdr_write_pages(xdr, pages, 0, length); |
244 | } | 243 | } |
@@ -388,7 +387,6 @@ out_overflow: | |||
388 | */ | 387 | */ |
389 | static void encode_ftype3(struct xdr_stream *xdr, const u32 type) | 388 | static void encode_ftype3(struct xdr_stream *xdr, const u32 type) |
390 | { | 389 | { |
391 | BUG_ON(type > NF3FIFO); | ||
392 | encode_uint32(xdr, type); | 390 | encode_uint32(xdr, type); |
393 | } | 391 | } |
394 | 392 | ||
@@ -443,7 +441,7 @@ static void encode_nfs_fh3(struct xdr_stream *xdr, const struct nfs_fh *fh) | |||
443 | { | 441 | { |
444 | __be32 *p; | 442 | __be32 *p; |
445 | 443 | ||
446 | BUG_ON(fh->size > NFS3_FHSIZE); | 444 | WARN_ON_ONCE(fh->size > NFS3_FHSIZE); |
447 | p = xdr_reserve_space(xdr, 4 + fh->size); | 445 | p = xdr_reserve_space(xdr, 4 + fh->size); |
448 | xdr_encode_opaque(p, fh->data, fh->size); | 446 | xdr_encode_opaque(p, fh->data, fh->size); |
449 | } | 447 | } |
@@ -1339,6 +1337,7 @@ static void nfs3_xdr_enc_setacl3args(struct rpc_rqst *req, | |||
1339 | error = nfsacl_encode(xdr->buf, base, args->inode, | 1337 | error = nfsacl_encode(xdr->buf, base, args->inode, |
1340 | (args->mask & NFS_ACL) ? | 1338 | (args->mask & NFS_ACL) ? |
1341 | args->acl_access : NULL, 1, 0); | 1339 | args->acl_access : NULL, 1, 0); |
1340 | /* FIXME: this is just broken */ | ||
1342 | BUG_ON(error < 0); | 1341 | BUG_ON(error < 0); |
1343 | error = nfsacl_encode(xdr->buf, base + error, args->inode, | 1342 | error = nfsacl_encode(xdr->buf, base + error, args->inode, |
1344 | (args->mask & NFS_DFACL) ? | 1343 | (args->mask & NFS_DFACL) ? |