diff options
author | Trond Myklebust <trond.myklebust@hammerspace.com> | 2019-02-18 10:02:29 -0500 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@hammerspace.com> | 2019-02-20 15:14:21 -0500 |
commit | a1231fda7e944adf37d8368b2e182041a39ea1ca (patch) | |
tree | 82eb1c7fa4acc00f7a6d2ce06dca07ac44666719 /net/sunrpc/sched.c | |
parent | e9acf2105fdba95953e786612243a4a3a1d0b166 (diff) | |
download | linux-stable-a1231fda7e944adf37d8368b2e182041a39ea1ca.tar.gz linux-stable-a1231fda7e944adf37d8368b2e182041a39ea1ca.tar.bz2 linux-stable-a1231fda7e944adf37d8368b2e182041a39ea1ca.zip |
SUNRPC: Set memalloc_nofs_save() on all rpciod/xprtiod jobs
Set memalloc_nofs_save() on all the rpciod/xprtiod jobs so that we
ensure memory allocations for asynchronous rpc calls don't ever end
up recursing back to the NFS layer for memory reclaim.
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to 'net/sunrpc/sched.c')
-rw-r--r-- | net/sunrpc/sched.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index adc3c40cc733..2168d4d9c09f 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c @@ -19,6 +19,7 @@ #include <linux/spinlock.h> #include <linux/mutex.h> #include <linux/freezer.h> +#include <linux/sched/mm.h> #include <linux/sunrpc/clnt.h> @@ -902,7 +903,10 @@ void rpc_execute(struct rpc_task *task) static void rpc_async_schedule(struct work_struct *work) { + unsigned int pflags = memalloc_nofs_save(); + __rpc_execute(container_of(work, struct rpc_task, u.tk_work)); + memalloc_nofs_restore(pflags); } /** @@ -1067,7 +1071,10 @@ static void rpc_free_task(struct rpc_task *task) static void rpc_async_release(struct work_struct *work) { + unsigned int pflags = memalloc_nofs_save(); + rpc_free_task(container_of(work, struct rpc_task, u.tk_work)); + memalloc_nofs_restore(pflags); } static void rpc_release_resources_task(struct rpc_task *task) |