netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] sunrpc: do not allow process to freeze within RPC state machine
@ 2016-08-03 16:54 Stanislav Kinsburskiy
  2016-08-03 17:36 ` Jeff Layton
  2016-08-03 17:36 ` Cyrill Gorcunov
  0 siblings, 2 replies; 7+ messages in thread
From: Stanislav Kinsburskiy @ 2016-08-03 16:54 UTC (permalink / raw)
  To: bfields, jlayton, trond.myklebust, anna.schumaker
  Cc: linux-nfs, netdev, linux-kernel, gorcunov, davem, devel

Otherwise freezer cgroup state might never become "FROZEN".

Here is a deadlock scheme for 2 processes in one freezer cgroup, which is
freezing:

CPU 0                                   CPU 1
--------                                --------
do_last
inode_lock(dir->d_inode)
vfs_create
nfs_create
...
__rpc_execute
rpc_wait_bit_killable
__refrigerator
                                        do_last
                                        inode_lock(dir->d_inode)

So, the problem is that one process takes directory inode mutex, executes
creation request and goes to refrigerator.
Another one waits till directory lock is released, remains "thawed" and thus
freezer cgroup state never becomes "FROZEN".

Notes:
1) Interesting, that this is not a pure deadlock: one can thaw cgroup and then
freeze it again.
2) The issue was introduced by commit d310310cbff18ec385c6ab4d58f33b100192a96a.
3) This patch is not aimed to fix the issue, but to show the problem root.
Look like this problem moght be applicable to other hunks from the commit,
mentioned above.


Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
---
 net/sunrpc/sched.c |    1 -
 1 file changed, 1 deletion(-)

diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index 9ae5885..ec7ccc1 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -253,7 +253,6 @@ EXPORT_SYMBOL_GPL(rpc_destroy_wait_queue);
 
 static int rpc_wait_bit_killable(struct wait_bit_key *key, int mode)
 {
-	freezable_schedule_unsafe();
 	if (signal_pending_state(mode, current))
 		return -ERESTARTSYS;
 	return 0;

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-08-04 13:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-03 16:54 [RFC PATCH] sunrpc: do not allow process to freeze within RPC state machine Stanislav Kinsburskiy
2016-08-03 17:36 ` Jeff Layton
2016-08-03 18:14   ` Chuck Lever
2016-08-04 10:55   ` Stanislav Kinsburskiy
     [not found]     ` <cb097e9e-760b-5512-ff4a-276b31bfc83f-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
2016-08-04 13:16       ` Jeff Layton
2016-08-04 13:57         ` Stanislav Kinsburskiy
2016-08-03 17:36 ` Cyrill Gorcunov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).