From: Trond Myklebust <trond.myklebust@fys.uio.no>
To: Aurelien Degremont <aurelien.degremont@cea.fr>
Cc: Jacques-Charles Lafoucriere <jc.lafoucriere@cea.fr>,
Bruno Faccini <bruno.faccini@bull.net>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Fix deadlock in RPC scheduling code.
Date: Thu, 09 Mar 2006 09:40:19 -0500 [thread overview]
Message-ID: <1141915219.8293.5.camel@lade.trondhjem.org> (raw)
In-Reply-To: <200603091035.LAA04829@styx.bruyeres.cea.fr>
On Thu, 2006-03-09 at 11:35 +0100, Aurelien Degremont wrote:
> Hello,
>
> Here is a small patch which fixes a deadlock issue in RPC scheduling
> code (rpc_wake_up_task() is mainly concerned). This problem happens if a
> RPC task, waiting for the response of a sync request, is woken up by a
> signal, and, in the same time, the kernel tries to wake up some RPC
> tasks. If this is done, a deadlock could occurs due to an error in RPC
> workqueue lock management.
>
> This error was added by linux-2.6.8.1-49-rpc_workqueue.patch (included
> in 2.6.11). This code was not changed since. The issue was detected on
> linux-2.6.12.
>
>
> **DESCRIPTION**
>
> This deadlock is due to the wrong management of two locks: queue->lock
> and the bit RPC_TASK_WAKEUP in task->tk_runstate.
> When dealing with RPC workqueues, the code must take care of locking the
> associated queue lock before doing any modifications on it or its tasks.
> And it does it... except for one function. Nested locks should always be
> taken in the same order.
>
> As a consequence, in some circumstances (in fact, I noticed it several
> times), this code deadlocks. Moreover, when this code is called, by
> example by nfs_file_flush(), the lock_kernel() is held and so all the
> system hangs.
>
>
> **PATCH**
>
> To fix the problem, we only need to invert the lock hierarchy in
> rpc_wake_up_task() and taking care of checking the task is really queued
> before trying to grab the lock.
No you can't. You have absolutely _no_ guarantee that
task->u.tk_wait.rpc_waitq is valid here.
The real fix is the one I posted in response to this thread last week.
See
http://client.linux-nfs.org/Linux-2.6.x/2.6.16-rc5/linux-2.6.16-89-fix_race_in_rpc_wakeup.dif
Cheers,
Trond
next prev parent reply other threads:[~2006-03-09 14:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-09 10:35 Aurelien Degremont
2006-03-09 14:40 ` Trond Myklebust [this message]
2006-03-10 15:10 ` Aurelien Degremont
2006-03-10 15:24 ` Trond Myklebust
2006-03-13 10:07 ` Aurelien Degremont
2006-03-13 14:28 ` Trond Myklebust
2006-03-13 15:16 ` Aurelien Degremont
2006-03-13 16:08 ` Trond Myklebust
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1141915219.8293.5.camel@lade.trondhjem.org \
--to=trond.myklebust@fys.uio.no \
--cc=aurelien.degremont@cea.fr \
--cc=bruno.faccini@bull.net \
--cc=jc.lafoucriere@cea.fr \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®