From patchwork Wed Mar 22 11:12:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 9638545 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8E2596020B for ; Wed, 22 Mar 2017 11:13:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8436C28418 for ; Wed, 22 Mar 2017 11:13:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78FC928454; Wed, 22 Mar 2017 11:13:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9DA5A28418 for ; Wed, 22 Mar 2017 11:13:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934202AbdCVLNJ (ORCPT ); Wed, 22 Mar 2017 07:13:09 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:35497 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933647AbdCVLNH (ORCPT ); Wed, 22 Mar 2017 07:13:07 -0400 Received: by mail-wr0-f196.google.com with SMTP id u108so26261619wrb.2 for ; Wed, 22 Mar 2017 04:13:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=2TQpRegWUtukaFycWZvMpob2B0LxUzlp1b6MAP9t2sQ=; b=CKK5qkW8NJioBZ+E0wObO1YGbS0iqnzgM9bqVDMBcdX7PsA9ggl8lk73qOz+dbRuW4 z3nsj5he1O3HjuyNNIPGa2s2L13T8l22ZBPCo8HlD3Ykxd9rE8UuwIUv/83P8dbBX53+ OD8SfBFn7DSNON/zm+bhG68aDJGTDnI3i21xmbD/vOnoZ/wNoTJb3NfpfFaZ7dyy5XcZ RDnVN+4I8dnB4mH5L7VtuqjAA97QK23/fsYHAJxjhbuqJWpw79TCjU4gzJDFtSmfGC5/ B5y7tT6xYAUQh2ua56dMhZCto07hvKt3Ye6XdDO3IKQWDPplCZjtRks6hYXhd/hK3CLv YcBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=2TQpRegWUtukaFycWZvMpob2B0LxUzlp1b6MAP9t2sQ=; b=TU/HllJM9tXVH+YYmiM5uB9U1NgkyVER+H35gfOnXqAwV9LtMLxFHvxQSIIc+xUGPc 8w7cHdegh2REvdsmyIi3n9X2BHhJbYBV7cOq+hQnra9yfAyd3bxLmQDWLW62yjriYIG4 q7CsyKibSengQF1zBPuAETzZ/03MxQkv/3FZT1ALhTgaq5JdvrdwbWEY5SYutdaV1FMn DFb7Fco+u/AIpVuDC41vhV7Wd28/HkQM3tOrxOPCVGwuSIsdHV4wuy4Npnv4M85G+HCV ZnEe8yioaLrb5tAySXkI582s2ZeXVNbSOvnxQnLsQU/73aA6OPmjEVAur0NpfT7zh6Iq d6Bw== X-Gm-Message-State: AFeK/H0BQRv//Wbup4ClywzlfABdaPwN0IaGjVF9+79pUuqBx1vxfcPYv2UVjU5B0Y3atg== X-Received: by 10.223.161.213 with SMTP id v21mr32430051wrv.144.1490181184594; Wed, 22 Mar 2017 04:13:04 -0700 (PDT) Received: from orange.redhat.com ([63.149.67.7]) by smtp.gmail.com with ESMTPSA id g73sm1737548wmd.27.2017.03.22.04.13.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Mar 2017 04:13:04 -0700 (PDT) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Subject: [PATCH] libceph: force GFP_NOIO for socket allocations Date: Wed, 22 Mar 2017 12:12:44 +0100 Message-Id: <1490181164-7822-1-git-send-email-idryomov@gmail.com> X-Mailer: git-send-email 2.4.3 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP sock_alloc_inode() allocates socket+inode and socket_wq with GFP_KERNEL, which is not allowed on the writeback path: Workqueue: ceph-msgr con_work [libceph] ffff8810871cb018 0000000000000046 0000000000000000 ffff881085d40000 0000000000012b00 ffff881025cad428 ffff8810871cbfd8 0000000000012b00 ffff880102fc1000 ffff881085d40000 ffff8810871cb038 ffff8810871cb148 Call Trace: [] schedule+0x29/0x70 [] schedule_timeout+0x1bd/0x200 [] ? ttwu_do_wakeup+0x2c/0x120 [] ? ttwu_do_activate.constprop.135+0x66/0x70 [] wait_for_completion+0xbf/0x180 [] ? try_to_wake_up+0x390/0x390 [] flush_work+0x165/0x250 [] ? worker_detach_from_pool+0xd0/0xd0 [] xlog_cil_force_lsn+0x81/0x200 [xfs] [] ? __slab_free+0xee/0x234 [] _xfs_log_force_lsn+0x4d/0x2c0 [xfs] [] ? lookup_page_cgroup_used+0xe/0x30 [] ? xfs_reclaim_inode+0xa3/0x330 [xfs] [] xfs_log_force_lsn+0x3f/0xf0 [xfs] [] ? xfs_reclaim_inode+0xa3/0x330 [xfs] [] xfs_iunpin_wait+0xc6/0x1a0 [xfs] [] ? wake_atomic_t_function+0x40/0x40 [] xfs_reclaim_inode+0xa3/0x330 [xfs] [] xfs_reclaim_inodes_ag+0x257/0x3d0 [xfs] [] xfs_reclaim_inodes_nr+0x33/0x40 [xfs] [] xfs_fs_free_cached_objects+0x15/0x20 [xfs] [] super_cache_scan+0x178/0x180 [] shrink_slab_node+0x14e/0x340 [] ? mem_cgroup_iter+0x16b/0x450 [] shrink_slab+0x100/0x140 [] do_try_to_free_pages+0x335/0x490 [] try_to_free_pages+0xb9/0x1f0 [] ? __alloc_pages_direct_compact+0x69/0x1be [] __alloc_pages_nodemask+0x69a/0xb40 [] alloc_pages_current+0x9e/0x110 [] new_slab+0x2c5/0x390 [] __slab_alloc+0x33b/0x459 [] ? sock_alloc_inode+0x2d/0xd0 [] ? inet_sendmsg+0x71/0xc0 [] ? sock_alloc_inode+0x2d/0xd0 [] kmem_cache_alloc+0x1a2/0x1b0 [] sock_alloc_inode+0x2d/0xd0 [] alloc_inode+0x26/0xa0 [] new_inode_pseudo+0x1a/0x70 [] sock_alloc+0x1e/0x80 [] __sock_create+0x95/0x220 [] sock_create_kern+0x24/0x30 [] con_work+0xef9/0x2050 [libceph] [] ? rbd_img_request_submit+0x4c/0x60 [rbd] [] process_one_work+0x159/0x4f0 [] worker_thread+0x11b/0x530 [] ? create_worker+0x1d0/0x1d0 [] kthread+0xc9/0xe0 [] ? flush_kthread_worker+0x90/0x90 [] ret_from_fork+0x58/0x90 [] ? flush_kthread_worker+0x90/0x90 Use memalloc_noio_{save,restore}() to temporarily force GFP_NOIO here. Cc: stable@vger.kernel.org # 3.10+, needs backporting Link: http://tracker.ceph.com/issues/19309 Reported-by: Sergey Jerusalimov Signed-off-by: Ilya Dryomov Reviewed-by: Jeff Layton --- net/ceph/messenger.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 38dcf1eb427d..f76bb3332613 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -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;