mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Frederik Deweerdt <deweerdt@free.fr>
To: Simon Derr <Simon.Derr@bull.net>
Cc: linux-kernel@vger.kernel.org,
	FACCINI BRUNO <Bruno.Faccini@bull.net>,
	Trond Myklebust <Trond.Myklebust@netapp.com>
Subject: Re: Deadlock in net/sunrpc/sched.c
Date: Thu, 2 Mar 2006 18:51:26 +0100	[thread overview]
Message-ID: <20060302175126.GA12335@silenus.home.res> (raw)
In-Reply-To: <Pine.LNX.4.61.0603021306540.15393@openx3.frec.bull.fr>

(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])

We don't need to __rpc_wake_up_task a task that is already
rpc_start_wakeup'ed after all.  BTW, there are other while
(!list_empty(head)) on sched.c that could need a similar rewrite.

Regards,
Frederik

  reply	other threads:[~2006-03-02 17:51 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 [this message]
2006-03-02 17:58         ` Trond Myklebust
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=20060302175126.GA12335@silenus.home.res \
    --to=deweerdt@free.fr \
    --cc=Bruno.Faccini@bull.net \
    --cc=Simon.Derr@bull.net \
    --cc=Trond.Myklebust@netapp.com \
    --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®