mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Trond Myklebust <Trond.Myklebust@netapp.com>
To: Frederik Deweerdt <deweerdt@free.fr>
Cc: Simon Derr <Simon.Derr@bull.net>,
	linux-kernel@vger.kernel.org,
	FACCINI BRUNO <Bruno.Faccini@bull.net>
Subject: Re: Deadlock in net/sunrpc/sched.c
Date: Thu, 02 Mar 2006 09:58:02 -0800	[thread overview]
Message-ID: <1141322282.10398.22.camel@netapplinux-10.connectathon.org> (raw)
In-Reply-To: <20060302175126.GA12335@silenus.home.res>

On Thu, 2006-03-02 at 18:51 +0100, Frederik Deweerdt wrote:
> (Added Trond Myklebust to the cc list, as he's working on sunrpc)
> > +	if (RPC_IS_QUEUED(task)) {
> > +		struct rpc_wait_queue *queue = task->u.tk_wait.rpc_waitq;
> > +		spin_lock_bh(&queue->lock);
> > +		if (rpc_start_wakeup(task))  {
> We may end up list_del'ing a task that is not queued
> anymore: we may be interrupted just after the RPC_IS_QUEUED test.
> Don't you think this patch could be enough?
> 
> --- linux-2.6.16-rc5/net/sunrpc/sched.c 2006-03-01 11:26:15.000000000 +0100
> +++ linux-2.6.16-rc5-2/net/sunrpc/sched.c       2006-03-02 15:43:18.000000000 +0100
> @@ -521,8 +521,7 @@
>         spin_lock_bh(&queue->lock);
>         head = &queue->tasks[queue->maxpriority];
>         for (;;) {
> -               while (!list_empty(head)) {
> -                       task = list_entry(head->next, struct rpc_task, u.tk_wait.list);
> +               list_for_each_entry(task, head, u.tk_wait.list) {
>                         __rpc_wake_up_task(task);
>                 }
>                 if (head == &queue->tasks[0])

You need a list_for_each_entry_safe() here, since __rpc_wake_up_task()
will cause the task to be removed from the list. See the patch I sent
out 1/2 hour ago.

Cheers
  Trond

  reply	other threads:[~2006-03-02 17:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-02 10:38 Simon Derr
2006-03-02 10:59 ` Frederik Deweerdt
2006-03-02 11:45   ` Simon Derr
2006-03-02 12:17     ` Simon Derr
2006-03-02 17:51       ` Frederik Deweerdt
2006-03-02 17:58         ` Trond Myklebust [this message]
2006-03-02 18:33           ` Frederik Deweerdt
2006-03-02 17:31     ` Trond Myklebust
2006-03-02 17:45 ` Trond Myklebust
2006-03-03  8:53   ` Simon Derr

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=1141322282.10398.22.camel@netapplinux-10.connectathon.org \
    --to=trond.myklebust@netapp.com \
    --cc=Bruno.Faccini@bull.net \
    --cc=Simon.Derr@bull.net \
    --cc=deweerdt@free.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®