]>
Commit | Line | Data |
---|---|---|
00e5a55c BS |
1 | From: Peter Zijlstra <a.p.zijlstra@chello.nl> |
2 | Subject: nfs: fix various memory recursions possible with swap over NFS. | |
3 | Patch-mainline: No | |
4 | References: FATE#303834 | |
5 | ||
6 | GFP_NOFS is _more_ permissive than GFP_NOIO in that it will initiate IO, | |
7 | just not of any filesystem data. | |
8 | ||
9 | The problem is that previuosly NOFS was correct because that avoids | |
10 | recursion into the NFS code, it now is not, because also IO (swap) can | |
11 | lead to this recursion. | |
12 | ||
13 | Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> | |
14 | Acked-by: Neil Brown <neilb@suse.de> | |
15 | Acked-by: Suresh Jayaraman <sjayaraman@suse.de> | |
16 | ||
17 | --- | |
18 | fs/nfs/pagelist.c | 2 +- | |
19 | fs/nfs/write.c | 6 +++--- | |
20 | 2 files changed, 4 insertions(+), 4 deletions(-) | |
21 | ||
22 | Index: linux-2.6.26/fs/nfs/write.c | |
23 | =================================================================== | |
24 | --- linux-2.6.26.orig/fs/nfs/write.c | |
25 | +++ linux-2.6.26/fs/nfs/write.c | |
26 | @@ -47,7 +47,7 @@ static mempool_t *nfs_commit_mempool; | |
27 | ||
28 | struct nfs_write_data *nfs_commitdata_alloc(void) | |
29 | { | |
30 | - struct nfs_write_data *p = mempool_alloc(nfs_commit_mempool, GFP_NOFS); | |
31 | + struct nfs_write_data *p = mempool_alloc(nfs_commit_mempool, GFP_NOIO); | |
32 | ||
33 | if (p) { | |
34 | memset(p, 0, sizeof(*p)); | |
35 | @@ -65,7 +65,7 @@ void nfs_commit_free(struct nfs_write_da | |
36 | ||
37 | struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount) | |
38 | { | |
39 | - struct nfs_write_data *p = mempool_alloc(nfs_wdata_mempool, GFP_NOFS); | |
40 | + struct nfs_write_data *p = mempool_alloc(nfs_wdata_mempool, GFP_NOIO); | |
41 | ||
42 | if (p) { | |
43 | memset(p, 0, sizeof(*p)); | |
44 | @@ -74,7 +74,7 @@ struct nfs_write_data *nfs_writedata_all | |
45 | if (pagecount <= ARRAY_SIZE(p->page_array)) | |
46 | p->pagevec = p->page_array; | |
47 | else { | |
48 | - p->pagevec = kcalloc(pagecount, sizeof(struct page *), GFP_NOFS); | |
49 | + p->pagevec = kcalloc(pagecount, sizeof(struct page *), GFP_NOIO); | |
50 | if (!p->pagevec) { | |
51 | mempool_free(p, nfs_wdata_mempool); | |
52 | p = NULL; | |
53 | Index: linux-2.6.26/fs/nfs/pagelist.c | |
54 | =================================================================== | |
55 | --- linux-2.6.26.orig/fs/nfs/pagelist.c | |
56 | +++ linux-2.6.26/fs/nfs/pagelist.c | |
57 | @@ -27,7 +27,7 @@ static inline struct nfs_page * | |
58 | nfs_page_alloc(void) | |
59 | { | |
60 | struct nfs_page *p; | |
61 | - p = kmem_cache_alloc(nfs_page_cachep, GFP_KERNEL); | |
62 | + p = kmem_cache_alloc(nfs_page_cachep, GFP_NOIO); | |
63 | if (p) { | |
64 | memset(p, 0, sizeof(*p)); | |
65 | INIT_LIST_HEAD(&p->wb_list); |