Skip to content

Commit

Permalink
SUNRPC: Set memalloc_nofs_save() for sync tasks
Browse files Browse the repository at this point in the history
[ Upstream commit f0940f4 ]

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: a1231fd ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Benjamin Coddington authored and gregkh committed Mar 17, 2021
1 parent 5f13849 commit e1e4c4b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion net/sunrpc/sched.c
Expand Up @@ -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)
Expand Down

0 comments on commit e1e4c4b

Please sign in to comment.