diff options
author | Jeff Layton <jlayton@redhat.com> | 2012-03-23 14:40:56 -0400 |
---|---|---|
committer | Jeff Layton <jlayton@redhat.com> | 2012-03-23 14:40:56 -0400 |
commit | e94f7ba124bfbd3898f620c46891ebcfb9cf20d0 (patch) | |
tree | cd7e54dadb4a7617b0fbbd6aaedbcbce4d3e43c4 /fs | |
parent | c2e8764009a0245fd24fcd2a63ffbf64236af016 (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')
-rw-r--r-- | fs/cifs/file.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index f624c4d4a393..70bd5464ffdf 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) | |||
2045 | unsigned long i; | 2045 | unsigned long i; |
2046 | 2046 | ||
2047 | for (i = 0; i < num_pages; i++) { | 2047 | for (i = 0; i < num_pages; i++) { |
2048 | pages[i] = alloc_page(__GFP_HIGHMEM); | 2048 | pages[i] = alloc_page(GFP_KERNEL|__GFP_HIGHMEM); |
2049 | if (!pages[i]) { | 2049 | if (!pages[i]) { |
2050 | /* | 2050 | /* |
2051 | * save number of pages we have already allocated and | 2051 | * 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 | */ | 2053 | */ |
2054 | num_pages = i; | 2054 | num_pages = i; |
2055 | rc = -ENOMEM; | 2055 | rc = -ENOMEM; |
2056 | goto error; | 2056 | break; |
2057 | } | 2057 | } |
2058 | } | 2058 | } |
2059 | 2059 | ||
2060 | return rc; | 2060 | if (rc) { |
2061 | 2061 | for (i = 0; i < num_pages; i++) | |
2062 | error: | 2062 | put_page(pages[i]); |
2063 | for (i = 0; i < num_pages; i++) | 2063 | } |
2064 | put_page(pages[i]); | ||
2065 | return rc; | 2064 | return rc; |
2066 | } | 2065 | } |
2067 | 2066 | ||