From: Manfred Spraul <manfred@colorfullife.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] remove sleep_on from sunrpc
Date: Sat, 17 Jan 2004 19:43:44 +0100 [thread overview]
Message-ID: <40098260.20800@colorfullife.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 400 bytes --]
sunrpc uses sleep_on to wait until the rpciod thread has died. This
could race if rpciod_down is called without lock_kernel. Right now all
calls in the main tree are under lock_kernel, but rpciod is an exported
function and sleep_on should die.
Additionally, I've replaced spin_lock_irqsave() with spin_lock_irq():
rpciod_down sleeps, interrupts are guaranteed to be enabled.
--
Manfred
[-- Attachment #2: patch-sleep_on_sunrpc --]
[-- Type: text/plain, Size: 1100 bytes --]
--- 2.6/net/sunrpc/sched.c 2004-01-17 12:19:50.000000000 +0100
+++ build-2.6/net/sunrpc/sched.c 2004-01-17 12:52:33.000000000 +0100
@@ -1060,7 +1060,7 @@
void
rpciod_down(void)
{
- unsigned long flags;
+ DECLARE_WAITQUEUE(wait, current);
down(&rpciod_sema);
dprintk("rpciod_down pid %d sema %d\n", rpciod_pid, rpciod_users);
@@ -1085,17 +1085,22 @@
/*
* Display a message if we're going to wait longer.
*/
- while (rpciod_pid) {
+ add_wait_queue(&rpciod_killer, &wait);
+ for (;;) {
+ set_current_state(TASK_INTERRUPTIBLE);
+ if (rpciod_pid == 0)
+ break;
dprintk("rpciod_down: waiting for pid %d to exit\n", rpciod_pid);
if (signalled()) {
dprintk("rpciod_down: caught signal\n");
break;
}
- interruptible_sleep_on(&rpciod_killer);
+ schedule();
}
- spin_lock_irqsave(¤t->sighand->siglock, flags);
+ remove_wait_queue(&rpciod_killer, &wait);
+ spin_lock_irq(¤t->sighand->siglock);
recalc_sigpending();
- spin_unlock_irqrestore(¤t->sighand->siglock, flags);
+ spin_unlock_irq(¤t->sighand->siglock);
out:
up(&rpciod_sema);
}
next reply other threads:[~2004-01-17 18:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-17 18:43 Manfred Spraul [this message]
2004-01-18 1:45 ` [PATCH] remove sleep_on from sunrpc Peter Osterlund
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=40098260.20800@colorfullife.com \
--to=manfred@colorfullife.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