From: Stefan Rompf <srompf@isg.de>
To: netdev@oss.sgi.com
Cc: davem@redhat.com
Subject: Patch: Make linkwatch more robust against rtnl holders
Date: Sun, 15 Feb 2004 15:11:47 +0100 [thread overview]
Message-ID: <200402151511.49432.srompf@isg.de> (raw)
[-- Attachment #1: Type: text/plain, Size: 464 bytes --]
Hi David,
the attached patch updates the linkwatch code so that it backs off and retries
whenever it cannot get the rtnl semaphore.
This makes it more robust against unrelated processes calling
flush_scheduled_work() while holding the rtnl lock. This problem was reported
on netdev for the sungem driver.
I preferred rescheduling every 1/10 second against creating a kernel thread as
the code is shorter, and the situation should not happen anyway.
Stefan
[-- Attachment #2: patch-linkwatch-2.6.1 --]
[-- Type: text/x-diff, Size: 737 bytes --]
--- net/core/link_watch.c.old 2003-12-26 20:38:25.000000000 +0100
+++ net/core/link_watch.c 2004-01-30 20:07:57.000000000 +0100
@@ -84,6 +84,8 @@
static void linkwatch_event(void *dummy)
{
+ if (rtnl_shlock_nowait()) goto out_err1;
+ if (rtnl_exlock_nowait()) goto out_err2;
/* Limit the number of linkwatch events to one
* per second so that a runaway driver does not
* cause a storm of messages on the netlink
@@ -92,11 +94,16 @@
linkwatch_nextevent = jiffies + HZ;
clear_bit(LW_RUNNING, &linkwatch_flags);
- rtnl_shlock();
- rtnl_exlock();
linkwatch_run_queue();
rtnl_exunlock();
rtnl_shunlock();
+
+ return;
+
+out_err2:
+ rtnl_shunlock();
+out_err1:
+ schedule_delayed_work(&linkwatch_work, HZ / 10);
}
next reply other threads:[~2004-02-15 14:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-15 14:11 Stefan Rompf [this message]
2004-02-19 1:11 ` Patch: Make linkwatch more robust against rtnl holders David S. Miller
2004-02-19 1:18 ` Jeff Garzik
2004-02-20 16:44 ` Stefan Rompf
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=200402151511.49432.srompf@isg.de \
--to=srompf@isg.de \
--cc=davem@redhat.com \
--cc=netdev@oss.sgi.com \
/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;
as well as URLs for NNTP newsgroup(s).