diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index 9358c79fd589..ab3aff71ff93 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.h>
#include <linux/sunrpc/clnt.h>
@@ -821,9 +822,9 @@ void rpc_execute(struct rpc_task *task)
static void rpc_async_schedule(struct work_struct *work)
{
- current->flags |= PF_FSTRANS;
+ current->flags |= PF_FSTRANS | PF_MEMALLOC_NOIO;
__rpc_execute(container_of(work, struct rpc_task, u.tk_work));
- current->flags &= ~PF_FSTRANS;
+ current->flags &= ~(PF_FSTRANS | PF_MEMALLOC_NOIO);
}
/**diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 43cd89eacfab..1d6d4d84b299 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -38,6 +38,7 @@
#include <linux/sunrpc/svcsock.h>
#include <linux/sunrpc/xprtsock.h>
#include <linux/file.h>
+#include <linux/sched.h>
#ifdef CONFIG_SUNRPC_BACKCHANNEL
#include <linux/sunrpc/bc_xprt.h>
#endif
@@ -1927,7 +1928,7 @@ static int xs_local_setup_socket(struct sock_xprt *transport)
struct socket *sock;
int status = -EIO;
- current->flags |= PF_FSTRANS;
+ current->flags |= PF_FSTRANS | PF_MEMALLOC_NOIO;
clear_bit(XPRT_CONNECTION_ABORT, &xprt->state);
status = __sock_create(xprt->xprt_net, AF_LOCAL,
@@ -1968,7 +1969,7 @@ static int xs_local_setup_socket(struct sock_xprt *transport)
out:
xprt_clear_connecting(xprt);
xprt_wake_pending_tasks(xprt, status);
- current->flags &= ~PF_FSTRANS;
+ current->flags &= ~(PF_FSTRANS | PF_MEMALLOC_NOIO);
return status;
}
@@ -2071,7 +2072,7 @@ static void xs_udp_setup_socket(struct work_struct *work)
struct socket *sock = transport->sock;
int status = -EIO;
- current->flags |= PF_FSTRANS;
+ current->flags |= PF_FSTRANS | PF_MEMALLOC_NOIO;
/* Start by resetting any existing state */
xs_reset_transport(transport);
@@ -2092,7 +2093,7 @@ static void xs_udp_setup_socket(struct work_struct *work)
out:
xprt_clear_connecting(xprt);
xprt_wake_pending_tasks(xprt, status);
- current->flags &= ~PF_FSTRANS;
+ current->flags &= ~(PF_FSTRANS | PF_MEMALLOC_NOIO);
}
/*
@@ -2229,7 +2230,7 @@ static void xs_tcp_setup_socket(struct work_struct *work)
struct rpc_xprt *xprt = &transport->xprt;
int status = -EIO;
- current->flags |= PF_FSTRANS;
+ current->flags |= PF_FSTRANS | PF_MEMALLOC_NOIO;
if (!sock) {
clear_bit(XPRT_CONNECTION_ABORT, &xprt->state);@@ -2276,7 +2277,7 @@ static void xs_tcp_setup_socket(struct work_struct *work)
case -EINPROGRESS:
case -EALREADY:
xprt_clear_connecting(xprt);
- current->flags &= ~PF_FSTRANS;
+ current->flags &= ~(PF_FSTRANS | PF_MEMALLOC_NOIO);
return;
case -EINVAL:
/* Happens, for instance, if the user specified a link
@@ -2294,7 +2295,7 @@ out_eagain:
out:
xprt_clear_connecting(xprt);
xprt_wake_pending_tasks(xprt, status);
- current->flags &= ~PF_FSTRANS;
+ current->flags &= ~(PF_FSTRANS | PF_MEMALLOC_NOIO);
}
/**
--
1.9.3