A fix for a writeback deadlock caused by a GFP_KERNEL allocation on the

reclaim path, tagged for stable.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQEcBAABCAAGBQJY1QoTAAoJEEp/3jgCEfOLtnoH/0uj3Y2QUVHDo0Je9HkQhzVC
 Mp2a/WzN1YO/wdYRdxs6LbVqMIukPJ5kKbKO3WIgpJZR9lxSM9k5Y0YC98YVBHuB
 v1uuTPe60fmdJRYnoD4/SfwXiIiAF5/dzPp80SI4xQ9zN24dS1wBREkH2eXUeoKL
 FCEoHUv7cJju1dGNbcGpv4MV75b0e+HHAxPuDG4fiUdT79Vp+wP7exx0lMkS9ub8
 i5T1GU5gDDBR+SKhpqMIvNgR7s3zdInUs476tk6jz/o049BwybkLIuDhx0+x93/g
 1Y1KXHYPCT3yZeL5kdJxM6Dul6wDYOsr2/wIPHzY0ym9RXqCEy/PFowJnL+7eWk=
 =cTM6
 -----END PGP SIGNATURE-----

Merge tag 'ceph-for-4.11-rc4' of git://github.com/ceph/ceph-client

Pull ceph fix from Ilya Dryomov:
 "A fix for a writeback deadlock caused by a GFP_KERNEL allocation on
  the reclaim path, tagged for stable"

* tag 'ceph-for-4.11-rc4' of git://github.com/ceph/ceph-client:
  libceph: force GFP_NOIO for socket allocations
This commit is contained in:
Linus Torvalds 2017-03-24 14:35:39 -07:00
commit 59d9cb91d0
1 changed files with 6 additions and 0 deletions

View File

@ -7,6 +7,7 @@
#include <linux/kthread.h>
#include <linux/net.h>
#include <linux/nsproxy.h>
#include <linux/sched/mm.h>
#include <linux/slab.h>
#include <linux/socket.h>
#include <linux/string.h>
@ -469,11 +470,16 @@ static int ceph_tcp_connect(struct ceph_connection *con)
{
struct sockaddr_storage *paddr = &con->peer_addr.in_addr;
struct socket *sock;
unsigned int noio_flag;
int ret;
BUG_ON(con->sock);
/* sock_create_kern() allocates with GFP_KERNEL */
noio_flag = memalloc_noio_save();
ret = sock_create_kern(read_pnet(&con->msgr->net), paddr->ss_family,
SOCK_STREAM, IPPROTO_TCP, &sock);
memalloc_noio_restore(noio_flag);
if (ret)
return ret;
sock->sk->sk_allocation = GFP_NOFS;