Re: Deadlock in net/sunrpc/sched.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



(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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux