aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ocfs2/cluster/tcp.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
index 509e6d5415e2..97de0fbd9f78 100644
--- a/fs/ocfs2/cluster/tcp.c
+++ b/fs/ocfs2/cluster/tcp.c
@@ -1601,7 +1601,15 @@ static void o2net_start_connect(struct work_struct *work)
1601 struct sockaddr_in myaddr = {0, }, remoteaddr = {0, }; 1601 struct sockaddr_in myaddr = {0, }, remoteaddr = {0, };
1602 int ret = 0, stop; 1602 int ret = 0, stop;
1603 unsigned int timeout; 1603 unsigned int timeout;
1604 unsigned int noio_flag;
1604 1605
1606 /*
1607 * sock_create allocates the sock with GFP_KERNEL. We must set
1608 * per-process flag PF_MEMALLOC_NOIO so that all allocations done
1609 * by this process are done as if GFP_NOIO was specified. So we
1610 * are not reentering filesystem while doing memory reclaim.
1611 */
1612 noio_flag = memalloc_noio_save();
1605 /* if we're greater we initiate tx, otherwise we accept */ 1613 /* if we're greater we initiate tx, otherwise we accept */
1606 if (o2nm_this_node() <= o2net_num_from_nn(nn)) 1614 if (o2nm_this_node() <= o2net_num_from_nn(nn))
1607 goto out; 1615 goto out;
@@ -1710,6 +1718,7 @@ out:
1710 if (mynode) 1718 if (mynode)
1711 o2nm_node_put(mynode); 1719 o2nm_node_put(mynode);
1712 1720
1721 memalloc_noio_restore(noio_flag);
1713 return; 1722 return;
1714} 1723}
1715 1724
@@ -1836,6 +1845,15 @@ static int o2net_accept_one(struct socket *sock, int *more)
1836 struct o2nm_node *local_node = NULL; 1845 struct o2nm_node *local_node = NULL;
1837 struct o2net_sock_container *sc = NULL; 1846 struct o2net_sock_container *sc = NULL;
1838 struct o2net_node *nn; 1847 struct o2net_node *nn;
1848 unsigned int noio_flag;
1849
1850 /*
1851 * sock_create_lite allocates the sock with GFP_KERNEL. We must set
1852 * per-process flag PF_MEMALLOC_NOIO so that all allocations done
1853 * by this process are done as if GFP_NOIO was specified. So we
1854 * are not reentering filesystem while doing memory reclaim.
1855 */
1856 noio_flag = memalloc_noio_save();
1839 1857
1840 BUG_ON(sock == NULL); 1858 BUG_ON(sock == NULL);
1841 *more = 0; 1859 *more = 0;
@@ -1952,6 +1970,8 @@ out:
1952 o2nm_node_put(local_node); 1970 o2nm_node_put(local_node);
1953 if (sc) 1971 if (sc)
1954 sc_put(sc); 1972 sc_put(sc);
1973
1974 memalloc_noio_restore(noio_flag);
1955 return ret; 1975 return ret;
1956} 1976}
1957 1977