rpc: let xdr layer allocate gssproxy receieve pages
In theory the linux cred in a gssproxy reply can include up to NGROUPS_MAX data, 256K of data. In the common case we expect it to be shorter. So do as the nfsv3 ACL code does and let the xdr code allocate the pages as they come in, instead of allocating a lot of pages that won't typically be used. Tested-by: Simo Sorce <simo@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:
parent
9dfd87da1a
commit
d4a516560f
|
@ -223,18 +223,14 @@ static void gssp_free_receive_pages(struct gssx_arg_accept_sec_context *arg)
|
||||||
|
|
||||||
static int gssp_alloc_receive_pages(struct gssx_arg_accept_sec_context *arg)
|
static int gssp_alloc_receive_pages(struct gssx_arg_accept_sec_context *arg)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
arg->npages = DIV_ROUND_UP(NGROUPS_MAX * 4, PAGE_SIZE);
|
arg->npages = DIV_ROUND_UP(NGROUPS_MAX * 4, PAGE_SIZE);
|
||||||
arg->pages = kzalloc(arg->npages * sizeof(struct page *), GFP_KERNEL);
|
arg->pages = kzalloc(arg->npages * sizeof(struct page *), GFP_KERNEL);
|
||||||
|
/*
|
||||||
for (i=0; i < arg->npages; i++) {
|
* XXX: actual pages are allocated by xdr layer in
|
||||||
arg->pages[i] = alloc_page(GFP_KERNEL);
|
* xdr_partial_copy_from_skb.
|
||||||
if (arg->pages[i] == NULL) {
|
*/
|
||||||
gssp_free_receive_pages(arg);
|
if (!arg->pages)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue