Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SUNRPC: Fix memory reclaim deadlocks in rpciod
Junxiao Bi reports seeing the following deadlock: @ crash> bt 1539 @ PID: 1539 TASK: ffff88178f64a040 CPU: 1 COMMAND: "rpciod/1" @ #0 [ffff88178f64d2c0] schedule at ffffffff8145833a @ #1 [ffff88178f64d348] io_schedule at ffffffff8145842c @ #2 [ffff88178f64d368] sync_page at ffffffff810d8161 @ #3 [ffff88178f64d378] __wait_on_bit at ffffffff8145895b @ #4 [ffff88178f64d3b8] wait_on_page_bit at ffffffff810d82fe @ #5 [ffff88178f64d418] wait_on_page_writeback at ffffffff810e2a1a @ torvalds#6 [ffff88178f64d438] shrink_page_list at ffffffff810e34e1 @ torvalds#7 [ffff88178f64d588] shrink_list at ffffffff810e3dbe @ torvalds#8 [ffff88178f64d6f8] shrink_zone at ffffffff810e425e @ torvalds#9 [ffff88178f64d7b8] do_try_to_free_pages at ffffffff810e4978 @ torvalds#10 [ffff88178f64d828] try_to_free_pages at ffffffff810e4c31 @ torvalds#11 [ffff88178f64d8c8] __alloc_pages_nodemask at ffffffff810de370 @ torvalds#12 [ffff88178f64d978] kmem_getpages at ffffffff8110e18b @ torvalds#13 [ffff88178f64d9a8] fallback_alloc at ffffffff8110e35e @ torvalds#14 [ffff88178f64da08] ____cache_alloc_node at ffffffff8110e51f @ torvalds#15 [ffff88178f64da48] __kmalloc at ffffffff8110efba @ torvalds#16 [ffff88178f64da98] xs_setup_xprt at ffffffffa00a563f [sunrpc] @ torvalds#17 [ffff88178f64dad8] xs_setup_tcp at ffffffffa00a7648 [sunrpc] @ torvalds#18 [ffff88178f64daf8] xprt_create_transport at ffffffffa00a478f [sunrpc] @ torvalds#19 [ffff88178f64db18] rpc_create at ffffffffa00a2d7a [sunrpc] @ torvalds#20 [ffff88178f64dbf8] rpcb_create at ffffffffa00b026b [sunrpc] @ torvalds#21 [ffff88178f64dc98] rpcb_getport_async at ffffffffa00b0c94 [sunrpc] @ torvalds#22 [ffff88178f64ddf8] call_bind at ffffffffa00a11f8 [sunrpc] @ torvalds#23 [ffff88178f64de18] __rpc_execute at ffffffffa00a88ef [sunrpc] @ torvalds#24 [ffff88178f64de58] rpc_async_schedule at ffffffffa00a9187 [sunrpc] @ torvalds#25 [ffff88178f64de78] worker_thread at ffffffff81072ed2 @ torvalds#26 [ffff88178f64dee8] kthread at ffffffff81076df3 @ torvalds#27 [ffff88178f64df48] kernel_thread at ffffffff81012e2a @ crash> Junxiao notes that the problem is not limited to the rpcbind client. In fact we can trigger the exact same problem when trying to reconnect to the server, and we find ourselves calling sock_alloc(). The following solution should work for all kernels that support the PF_MEMALLOC_NOIO flag (i.e. Linux 3.9 and newer). Link: http://lkml.kernel.org/r/53F6F772.6020708@oracle.com Reported-by: Junxiao Bi <junxiao.bi@oracle.com> Cc: stable@vger.kernel.org # 3.9+ Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
- Loading branch information