summaryrefslogtreecommitdiff
path: root/fs/cifs
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2012-03-23 14:40:56 -0400
committerJeff Layton <jlayton@redhat.com>2012-03-23 14:40:56 -0400
commite94f7ba124bfbd3898f620c46891ebcfb9cf20d0 (patch)
treecd7e54dadb4a7617b0fbbd6aaedbcbce4d3e43c4 /fs/cifs
parentc2e8764009a0245fd24fcd2a63ffbf64236af016 (diff)
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: Jeff Layton <jlayton@redhat.com> Acked-by: Pavel Shilovsky <piastry@etersoft.ru>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/file.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index f624c4d4a39..70bd5464ffd 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -2045,7 +2045,7 @@ cifs_write_allocate_pages(struct page **pages, unsigned long num_pages)
unsigned long 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]) {
/*
* save number of pages we have already allocated and
@@ -2053,15 +2053,14 @@ cifs_write_allocate_pages(struct page **pages, unsigned long num_pages)
*/
num_pages = i;
rc = -ENOMEM;
- goto error;
+ break;
}
}
- return rc;
-
-error:
- for (i = 0; i < num_pages; i++)
- put_page(pages[i]);
+ if (rc) {
+ for (i = 0; i < num_pages; i++)
+ put_page(pages[i]);
+ }
return rc;
}