提交 e94f7ba1 编写于 作者: J Jeff Layton

cifs: fix allocation in cifs_write_allocate_pages

The gfp flags are currently set to __GPF_HIGHMEM, which doesn't allow
for any reclaim. Make this more resilient by or'ing that with
GFP_KERNEL. Also, get rid of the goto and unify the exit codepath.
Signed-off-by: NJeff Layton <jlayton@redhat.com>
Acked-by: NPavel Shilovsky <piastry@etersoft.ru>
上级 c2e87640
...@@ -2045,7 +2045,7 @@ cifs_write_allocate_pages(struct page **pages, unsigned long num_pages) ...@@ -2045,7 +2045,7 @@ cifs_write_allocate_pages(struct page **pages, unsigned long num_pages)
unsigned long i; unsigned long i;
for (i = 0; i < num_pages; i++) { for (i = 0; i < num_pages; i++) {
pages[i] = alloc_page(__GFP_HIGHMEM); pages[i] = alloc_page(GFP_KERNEL|__GFP_HIGHMEM);
if (!pages[i]) { if (!pages[i]) {
/* /*
* save number of pages we have already allocated and * save number of pages we have already allocated and
...@@ -2053,15 +2053,14 @@ cifs_write_allocate_pages(struct page **pages, unsigned long num_pages) ...@@ -2053,15 +2053,14 @@ cifs_write_allocate_pages(struct page **pages, unsigned long num_pages)
*/ */
num_pages = i; num_pages = i;
rc = -ENOMEM; rc = -ENOMEM;
goto error; break;
} }
} }
return rc; if (rc) {
for (i = 0; i < num_pages; i++)
error: put_page(pages[i]);
for (i = 0; i < num_pages; i++) }
put_page(pages[i]);
return rc; return rc;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册