SUNRPC: remove BUG_ONs checking RPCSVC_MAXPAGES
Replace two bounds checking BUG_ON() calls with WARN_ON_ONCE() and resetting the requested size to RPCSVC_MAXPAGES. Signed-off-by: Weston Andros Adamson <dros@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
parent
ff1fdb9b80
commit
b25cd058f2
|
@ -587,7 +587,9 @@ svc_init_buffer(struct svc_rqst *rqstp, unsigned int size, int node)
|
||||||
* We assume one is at most one page
|
* We assume one is at most one page
|
||||||
*/
|
*/
|
||||||
arghi = 0;
|
arghi = 0;
|
||||||
BUG_ON(pages > RPCSVC_MAXPAGES);
|
WARN_ON_ONCE(pages > RPCSVC_MAXPAGES);
|
||||||
|
if (pages > RPCSVC_MAXPAGES)
|
||||||
|
pages = RPCSVC_MAXPAGES;
|
||||||
while (pages) {
|
while (pages) {
|
||||||
struct page *p = alloc_pages_node(node, GFP_KERNEL, 0);
|
struct page *p = alloc_pages_node(node, GFP_KERNEL, 0);
|
||||||
if (!p)
|
if (!p)
|
||||||
|
|
|
@ -579,7 +579,10 @@ int svc_alloc_arg(struct svc_rqst *rqstp)
|
||||||
|
|
||||||
/* now allocate needed pages. If we get a failure, sleep briefly */
|
/* now allocate needed pages. If we get a failure, sleep briefly */
|
||||||
pages = (serv->sv_max_mesg + PAGE_SIZE) / PAGE_SIZE;
|
pages = (serv->sv_max_mesg + PAGE_SIZE) / PAGE_SIZE;
|
||||||
BUG_ON(pages >= RPCSVC_MAXPAGES);
|
WARN_ON_ONCE(pages >= RPCSVC_MAXPAGES);
|
||||||
|
if (pages >= RPCSVC_MAXPAGES)
|
||||||
|
/* use as many pages as possible */
|
||||||
|
pages = RPCSVC_MAXPAGES - 1;
|
||||||
for (i = 0; i < pages ; i++)
|
for (i = 0; i < pages ; i++)
|
||||||
while (rqstp->rq_pages[i] == NULL) {
|
while (rqstp->rq_pages[i] == NULL) {
|
||||||
struct page *p = alloc_page(GFP_KERNEL);
|
struct page *p = alloc_page(GFP_KERNEL);
|
||||||
|
|
Loading…
Reference in New Issue