Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932603AbZJAOJ2 (ORCPT ); Thu, 1 Oct 2009 10:09:28 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756158AbZJAOJ0 (ORCPT ); Thu, 1 Oct 2009 10:09:26 -0400 Received: from victor.provo.novell.com ([137.65.250.26]:42271 "EHLO victor.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932527AbZJAOJX (ORCPT ); Thu, 1 Oct 2009 10:09:23 -0400 From: Suresh Jayaraman To: Linus Torvalds , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: netdev@vger.kernel.org, Neil Brown , Miklos Szeredi , Wouter Verhelst , Peter Zijlstra , trond.myklebust@fys.uio.no, Suresh Jayaraman Subject: [PATCH 28/31] nfs: fix various memory recursions possible with swap over NFS. Date: Thu, 1 Oct 2009 19:40:32 +0530 Message-Id: <1254406232-16663-1-git-send-email-sjayaraman@suse.de> X-Mailer: git-send-email 1.6.0.2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2369 Lines: 66 From: Peter Zijlstra GFP_NOFS is _more_ permissive than GFP_NOIO in that it will initiate IO, just not of any filesystem data. The problem is that previuosly NOFS was correct because that avoids recursion into the NFS code, it now is not, because also IO (swap) can lead to this recursion. Signed-off-by: Peter Zijlstra Signed-off-by: Suresh Jayaraman --- fs/nfs/pagelist.c | 2 +- fs/nfs/write.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) Index: mmotm/fs/nfs/write.c =================================================================== --- mmotm.orig/fs/nfs/write.c +++ mmotm/fs/nfs/write.c @@ -48,7 +48,7 @@ static mempool_t *nfs_commit_mempool; struct nfs_write_data *nfs_commitdata_alloc(void) { - struct nfs_write_data *p = mempool_alloc(nfs_commit_mempool, GFP_NOFS); + struct nfs_write_data *p = mempool_alloc(nfs_commit_mempool, GFP_NOIO); if (p) { memset(p, 0, sizeof(*p)); @@ -67,7 +67,7 @@ void nfs_commit_free(struct nfs_write_da struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount) { - struct nfs_write_data *p = mempool_alloc(nfs_wdata_mempool, GFP_NOFS); + struct nfs_write_data *p = mempool_alloc(nfs_wdata_mempool, GFP_NOIO); if (p) { memset(p, 0, sizeof(*p)); @@ -77,7 +77,8 @@ struct nfs_write_data *nfs_writedata_all if (pagecount <= ARRAY_SIZE(p->page_array)) p->pagevec = p->page_array; else { - p->pagevec = kcalloc(pagecount, sizeof(struct page *), GFP_NOFS); + p->pagevec = kcalloc(pagecount, sizeof(struct page *), + GFP_NOIO); if (!p->pagevec) { mempool_free(p, nfs_wdata_mempool); p = NULL; Index: mmotm/fs/nfs/pagelist.c =================================================================== --- mmotm.orig/fs/nfs/pagelist.c +++ mmotm/fs/nfs/pagelist.c @@ -27,7 +27,7 @@ static inline struct nfs_page * nfs_page_alloc(void) { struct nfs_page *p; - p = kmem_cache_alloc(nfs_page_cachep, GFP_KERNEL); + p = kmem_cache_alloc(nfs_page_cachep, GFP_NOIO); if (p) { memset(p, 0, sizeof(*p)); INIT_LIST_HEAD(&p->wb_list); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/