Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nfs: skip commit in releasepage if we're freeing memory for fs-relate…
…d reasons commit 5cf02d0 upstream. We've had some reports of a deadlock where rpciod ends up with a stack trace like this: PID: 2507 TASK: ffff88103691ab40 CPU: 14 COMMAND: "rpciod/14" #0 [ffff8810343bf2f0] schedule at ffffffff814dabd9 #1 [ffff8810343bf3b8] nfs_wait_bit_killable at ffffffffa038fc04 [nfs] imx6-dongle#2 [ffff8810343bf3c8] __wait_on_bit at ffffffff814dbc2f imx6-dongle#3 [ffff8810343bf418] out_of_line_wait_on_bit at ffffffff814dbcd8 imx6-dongle#4 [ffff8810343bf488] nfs_commit_inode at ffffffffa039e0c1 [nfs] imx6-dongle#5 [ffff8810343bf4f8] nfs_release_page at ffffffffa038bef6 [nfs] imx6-dongle#6 [ffff8810343bf528] try_to_release_page at ffffffff8110c670 imx6-dongle#7 [ffff8810343bf538] shrink_page_list.clone.0 at ffffffff81126271 imx6-dongle#8 [ffff8810343bf668] shrink_inactive_list at ffffffff81126638 imx6-dongle#9 [ffff8810343bf818] shrink_zone at ffffffff8112788f imx6-dongle#10 [ffff8810343bf8c8] do_try_to_free_pages at ffffffff81127b1e imx6-dongle#11 [ffff8810343bf958] try_to_free_pages at ffffffff8112812f imx6-dongle#12 [ffff8810343bfa08] __alloc_pages_nodemask at ffffffff8111fdad imx6-dongle#13 [ffff8810343bfb28] kmem_getpages at ffffffff81159942 imx6-dongle#14 [ffff8810343bfb58] fallback_alloc at ffffffff8115a55a imx6-dongle#15 [ffff8810343bfbd8] ____cache_alloc_node at ffffffff8115a2d9 imx6-dongle#16 [ffff8810343bfc38] kmem_cache_alloc at ffffffff8115b09b imx6-dongle#17 [ffff8810343bfc78] sk_prot_alloc at ffffffff81411808 imx6-dongle#18 [ffff8810343bfcb8] sk_alloc at ffffffff8141197c imx6-dongle#19 [ffff8810343bfce8] inet_create at ffffffff81483ba6 #20 [ffff8810343bfd38] __sock_create at ffffffff8140b4a7 #21 [ffff8810343bfd98] xs_create_sock at ffffffffa01f649b [sunrpc] #22 [ffff8810343bfdd8] xs_tcp_setup_socket at ffffffffa01f6965 [sunrpc] #23 [ffff8810343bfe38] worker_thread at ffffffff810887d0 #24 [ffff8810343bfee8] kthread at ffffffff8108dd96 #25 [ffff8810343bff48] kernel_thread at ffffffff8100c1ca rpciod is trying to allocate memory for a new socket to talk to the server. The VM ends up calling ->releasepage to get more memory, and it tries to do a blocking commit. That commit can't succeed however without a connected socket, so we deadlock. Fix this by setting PF_FSTRANS on the workqueue task prior to doing the socket allocation, and having nfs_release_page check for that flag when deciding whether to do a commit call. Also, set PF_FSTRANS unconditionally in rpc_async_schedule since that function can also do allocations sometimes. Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Trond Myklebust <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
- Loading branch information