aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfs/file.c14
-rw-r--r--net/sunrpc/sched.c2
-rw-r--r--net/sunrpc/xprtrdma/transport.c2
-rw-r--r--net/sunrpc/xprtsock.c10
4 files changed, 6 insertions, 22 deletions
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 24832d040eb8..6920127c5eb7 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -476,20 +476,18 @@ static int nfs_release_page(struct page *page, gfp_t gfp)
476 dfprintk(PAGECACHE, "NFS: release_page(%p)\n", page); 476 dfprintk(PAGECACHE, "NFS: release_page(%p)\n", page);
477 477
478 /* Always try to initiate a 'commit' if relevant, but only 478 /* Always try to initiate a 'commit' if relevant, but only
479 * wait for it if __GFP_WAIT is set and the calling process is 479 * wait for it if __GFP_WAIT is set. Even then, only wait 1
480 * allowed to block. Even then, only wait 1 second and only 480 * second and only if the 'bdi' is not congested.
481 * if the 'bdi' is not congested.
482 * Waiting indefinitely can cause deadlocks when the NFS 481 * Waiting indefinitely can cause deadlocks when the NFS
483 * server is on this machine, and there is no particular need 482 * server is on this machine, when a new TCP connection is
484 * to wait extensively here. A short wait has the benefit 483 * needed and in other rare cases. There is no particular
485 * that someone else can worry about the freezer. 484 * need to wait extensively here. A short wait has the
485 * benefit that someone else can worry about the freezer.
486 */ 486 */
487 if (mapping) { 487 if (mapping) {
488 struct nfs_server *nfss = NFS_SERVER(mapping->host); 488 struct nfs_server *nfss = NFS_SERVER(mapping->host);
489 nfs_commit_inode(mapping->host, 0); 489 nfs_commit_inode(mapping->host, 0);
490 if ((gfp & __GFP_WAIT) && 490 if ((gfp & __GFP_WAIT) &&
491 !current_is_kswapd() &&
492 !(current->flags & PF_FSTRANS) &&
493 !bdi_write_congested(&nfss->backing_dev_info)) { 491 !bdi_write_congested(&nfss->backing_dev_info)) {
494 wait_on_page_bit_killable_timeout(page, PG_private, 492 wait_on_page_bit_killable_timeout(page, PG_private,
495 HZ); 493 HZ);
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index 9358c79fd589..fe3441abdbe5 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -821,9 +821,7 @@ void rpc_execute(struct rpc_task *task)
821 821
822static void rpc_async_schedule(struct work_struct *work) 822static void rpc_async_schedule(struct work_struct *work)
823{ 823{
824 current->flags |= PF_FSTRANS;
825 __rpc_execute(container_of(work, struct rpc_task, u.tk_work)); 824 __rpc_execute(container_of(work, struct rpc_task, u.tk_work));
826 current->flags &= ~PF_FSTRANS;
827} 825}
828 826
829/** 827/**
diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c
index 2faac4940563..6a4615dd0261 100644
--- a/net/sunrpc/xprtrdma/transport.c
+++ b/net/sunrpc/xprtrdma/transport.c
@@ -205,7 +205,6 @@ xprt_rdma_connect_worker(struct work_struct *work)
205 struct rpc_xprt *xprt = &r_xprt->xprt; 205 struct rpc_xprt *xprt = &r_xprt->xprt;
206 int rc = 0; 206 int rc = 0;
207 207
208 current->flags |= PF_FSTRANS;
209 xprt_clear_connected(xprt); 208 xprt_clear_connected(xprt);
210 209
211 dprintk("RPC: %s: %sconnect\n", __func__, 210 dprintk("RPC: %s: %sconnect\n", __func__,
@@ -216,7 +215,6 @@ xprt_rdma_connect_worker(struct work_struct *work)
216 215
217 dprintk("RPC: %s: exit\n", __func__); 216 dprintk("RPC: %s: exit\n", __func__);
218 xprt_clear_connecting(xprt); 217 xprt_clear_connecting(xprt);
219 current->flags &= ~PF_FSTRANS;
220} 218}
221 219
222/* 220/*
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 02603ec2460a..3b305ab17afe 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1954,8 +1954,6 @@ static int xs_local_setup_socket(struct sock_xprt *transport)
1954 struct socket *sock; 1954 struct socket *sock;
1955 int status = -EIO; 1955 int status = -EIO;
1956 1956
1957 current->flags |= PF_FSTRANS;
1958
1959 clear_bit(XPRT_CONNECTION_ABORT, &xprt->state); 1957 clear_bit(XPRT_CONNECTION_ABORT, &xprt->state);
1960 status = __sock_create(xprt->xprt_net, AF_LOCAL, 1958 status = __sock_create(xprt->xprt_net, AF_LOCAL,
1961 SOCK_STREAM, 0, &sock, 1); 1959 SOCK_STREAM, 0, &sock, 1);
@@ -1995,7 +1993,6 @@ static int xs_local_setup_socket(struct sock_xprt *transport)
1995out: 1993out:
1996 xprt_clear_connecting(xprt); 1994 xprt_clear_connecting(xprt);
1997 xprt_wake_pending_tasks(xprt, status); 1995 xprt_wake_pending_tasks(xprt, status);
1998 current->flags &= ~PF_FSTRANS;
1999 return status; 1996 return status;
2000} 1997}
2001 1998
@@ -2098,8 +2095,6 @@ static void xs_udp_setup_socket(struct work_struct *work)
2098 struct socket *sock = transport->sock; 2095 struct socket *sock = transport->sock;
2099 int status = -EIO; 2096 int status = -EIO;
2100 2097
2101 current->flags |= PF_FSTRANS;
2102
2103 /* Start by resetting any existing state */ 2098 /* Start by resetting any existing state */
2104 xs_reset_transport(transport); 2099 xs_reset_transport(transport);
2105 sock = xs_create_sock(xprt, transport, 2100 sock = xs_create_sock(xprt, transport,
@@ -2119,7 +2114,6 @@ static void xs_udp_setup_socket(struct work_struct *work)
2119out: 2114out:
2120 xprt_clear_connecting(xprt); 2115 xprt_clear_connecting(xprt);
2121 xprt_wake_pending_tasks(xprt, status); 2116 xprt_wake_pending_tasks(xprt, status);
2122 current->flags &= ~PF_FSTRANS;
2123} 2117}
2124 2118
2125/* 2119/*
@@ -2256,8 +2250,6 @@ static void xs_tcp_setup_socket(struct work_struct *work)
2256 struct rpc_xprt *xprt = &transport->xprt; 2250 struct rpc_xprt *xprt = &transport->xprt;
2257 int status = -EIO; 2251 int status = -EIO;
2258 2252
2259 current->flags |= PF_FSTRANS;
2260
2261 if (!sock) { 2253 if (!sock) {
2262 clear_bit(XPRT_CONNECTION_ABORT, &xprt->state); 2254 clear_bit(XPRT_CONNECTION_ABORT, &xprt->state);
2263 sock = xs_create_sock(xprt, transport, 2255 sock = xs_create_sock(xprt, transport,
@@ -2305,7 +2297,6 @@ static void xs_tcp_setup_socket(struct work_struct *work)
2305 case -EINPROGRESS: 2297 case -EINPROGRESS:
2306 case -EALREADY: 2298 case -EALREADY:
2307 xprt_clear_connecting(xprt); 2299 xprt_clear_connecting(xprt);
2308 current->flags &= ~PF_FSTRANS;
2309 return; 2300 return;
2310 case -EINVAL: 2301 case -EINVAL:
2311 /* Happens, for instance, if the user specified a link 2302 /* Happens, for instance, if the user specified a link
@@ -2323,7 +2314,6 @@ out_eagain:
2323out: 2314out:
2324 xprt_clear_connecting(xprt); 2315 xprt_clear_connecting(xprt);
2325 xprt_wake_pending_tasks(xprt, status); 2316 xprt_wake_pending_tasks(xprt, status);
2326 current->flags &= ~PF_FSTRANS;
2327} 2317}
2328 2318
2329/** 2319/**