summaryrefslogtreecommitdiff
path: root/net/sunrpc/sched.c
diff options
context:
space:
mode:
authorBenjamin Coddington <bcodding@redhat.com>2021-03-03 16:47:16 +0300
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2021-03-08 23:32:16 +0300
commitf0940f4b3284a00f38a5d42e6067c2aaa20e1f2e (patch)
tree450cd1a22f847863159bec811c5f99854310235b /net/sunrpc/sched.c
parentad3dbe35c833c2d4d0bbf3f04c785d32f931e7c9 (diff)
downloadlinux-f0940f4b3284a00f38a5d42e6067c2aaa20e1f2e.tar.xz
SUNRPC: Set memalloc_nofs_save() for sync tasks
We could recurse into NFS doing memory reclaim while sending a sync task, which might result in a deadlock. Set memalloc_nofs_save for sync task execution. Fixes: a1231fda7e94 ("SUNRPC: Set memalloc_nofs_save() on all rpciod/xprtiod jobs") Signed-off-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'net/sunrpc/sched.c')
-rw-r--r--net/sunrpc/sched.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index cf702a5f7fe5..39ed0e0afe6d 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -963,8 +963,11 @@ void rpc_execute(struct rpc_task *task)
rpc_set_active(task);
rpc_make_runnable(rpciod_workqueue, task);
- if (!is_async)
+ if (!is_async) {
+ unsigned int pflags = memalloc_nofs_save();
__rpc_execute(task);
+ memalloc_nofs_restore(pflags);
+ }
}
static void rpc_async_schedule(struct work_struct *work)