mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
NFS: Avoid writeback threads getting stuck in mempool_alloc()
In a low memory situation, allow the NFS writeback code to fail without getting stuck in infinite loops in mempool_alloc(). Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
This commit is contained in:
parent
515dcdcd48
commit
0bae835b63
2 changed files with 13 additions and 7 deletions
|
@ -94,9 +94,15 @@ EXPORT_SYMBOL_GPL(nfs_commit_free);
|
|||
|
||||
static struct nfs_pgio_header *nfs_writehdr_alloc(void)
|
||||
{
|
||||
struct nfs_pgio_header *p = mempool_alloc(nfs_wdata_mempool, GFP_KERNEL);
|
||||
struct nfs_pgio_header *p;
|
||||
|
||||
memset(p, 0, sizeof(*p));
|
||||
p = kmem_cache_zalloc(nfs_wdata_cachep, nfs_io_gfp_mask());
|
||||
if (!p) {
|
||||
p = mempool_alloc(nfs_wdata_mempool, GFP_NOWAIT);
|
||||
if (!p)
|
||||
return NULL;
|
||||
memset(p, 0, sizeof(*p));
|
||||
}
|
||||
p->rw_mode = FMODE_WRITE;
|
||||
return p;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue