Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 291769 Details for
Bug 251527
Fake ARP dropped after migration leading to loss of network connectivity
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
[NET] link_watch: Always schedule urgent events
p (text/plain), 4.45 KB, created by
Herbert Xu
on 2008-01-15 23:47:29 UTC
(
hide
)
Description:
[NET] link_watch: Always schedule urgent events
Filename:
MIME Type:
Creator:
Herbert Xu
Created:
2008-01-15 23:47:29 UTC
Size:
4.45 KB
patch
obsolete
>diff --git a/net/core/link_watch.c b/net/core/link_watch.c >index 4b36114..6895ef2 100644 >--- a/net/core/link_watch.c >+++ b/net/core/link_watch.c >@@ -27,7 +27,7 @@ > > > enum lw_bits { >- LW_RUNNING = 0, >+ LW_URGENT = 0, > LW_SE_USED > }; > >@@ -87,11 +87,80 @@ static void rfc2863_policy(struct net_device *dev) > } > > >-/* Must be called with the rtnl semaphore held */ >-void linkwatch_run_queue(void) >+static int linkwatch_urgent_event(struct net_device *dev) >+{ >+ return netif_running(dev) && netif_carrier_ok(dev) && >+ dev->qdisc != dev->qdisc_sleeping; >+} >+ >+ >+static void linkwatch_add_event(struct lw_event *event) >+{ >+ unsigned long flags; >+ >+ spin_lock_irqsave(&lweventlist_lock, flags); >+ list_add_tail(&event->list, &lweventlist); >+ spin_unlock_irqrestore(&lweventlist_lock, flags); >+} >+ >+ >+static void linkwatch_schedule_work(int urgent) >+{ >+ unsigned long delay = linkwatch_nextevent - jiffies; >+ >+ if (test_bit(LW_URGENT, &linkwatch_flags)) >+ return; >+ >+ /* Minimise down-time: drop delay for up event. */ >+ if (urgent) { >+ if (test_and_set_bit(LW_URGENT, &linkwatch_flags)) >+ return; >+ delay = 0; >+ } >+ >+ /* If we wrap around we'll delay it by at most HZ. */ >+ if (delay > HZ) >+ delay = 0; >+ >+ /* >+ * This is true if we've scheduled it immeditately or if we don't >+ * need an immediate execution and it's already pending. >+ */ >+ if (schedule_delayed_work(&linkwatch_work, delay) == !delay) >+ return; >+ >+ /* Don't bother if there is nothing urgent. */ >+ if (!test_bit(LW_URGENT, &linkwatch_flags)) >+ return; >+ >+ /* It's already running which is good enough. */ >+ if (!cancel_delayed_work(&linkwatch_work)) >+ return; >+ >+ /* Otherwise we reschedule it again for immediate exection. */ >+ schedule_delayed_work(&linkwatch_work, 0); >+} >+ >+ >+static void __linkwatch_run_queue(int urgent_only) > { > struct list_head head, *n, *next; > >+ /* >+ * 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 >+ * socket. This limit does not apply to up events >+ * while the device qdisc is down. >+ */ >+ if (!urgent_only) >+ linkwatch_nextevent = jiffies + HZ; >+ /* Limit wrap-around effect on delay. */ >+ else if (time_after(linkwatch_nextevent, jiffies + HZ)) >+ linkwatch_nextevent = jiffies; >+ >+ clear_bit(LW_URGENT, &linkwatch_flags); >+ > spin_lock_irq(&lweventlist_lock); > list_replace_init(&lweventlist, &head); > spin_unlock_irq(&lweventlist_lock); >@@ -100,6 +169,11 @@ void linkwatch_run_queue(void) > struct lw_event *event = list_entry(n, struct lw_event, list); > struct net_device *dev = event->dev; > >+ if (urgent_only && !linkwatch_urgent_event(dev)) { >+ linkwatch_add_event(event); >+ continue; >+ } >+ > if (event == &singleevent) { > clear_bit(LW_SE_USED, &linkwatch_flags); > } else { >@@ -124,29 +198,31 @@ void linkwatch_run_queue(void) > > dev_put(dev); > } >-} > >+ if (!list_empty(&lweventlist)) >+ linkwatch_schedule_work(0); >+} > >-static void linkwatch_event(void *dummy) >+ >+/* Must be called with the rtnl semaphore held */ >+void linkwatch_run_queue(void) > { >- /* 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 >- * socket >- */ >- linkwatch_nextevent = jiffies + HZ; >- clear_bit(LW_RUNNING, &linkwatch_flags); >+ __linkwatch_run_queue(0); >+} > >+static void linkwatch_event(void *dummy) >+{ > rtnl_lock(); >- linkwatch_run_queue(); >+ __linkwatch_run_queue(time_after(linkwatch_nextevent, jiffies)); > rtnl_unlock(); > } > > > void linkwatch_fire_event(struct net_device *dev) > { >+ int urgent = linkwatch_urgent_event(dev); >+ > if (!test_and_set_bit(__LINK_STATE_LINKWATCH_PENDING, &dev->state)) { >- unsigned long flags; > struct lw_event *event; > > if (test_and_set_bit(LW_SE_USED, &linkwatch_flags)) { >@@ -163,20 +239,11 @@ void linkwatch_fire_event(struct net_device *dev) > dev_hold(dev); > event->dev = dev; > >- spin_lock_irqsave(&lweventlist_lock, flags); >- list_add_tail(&event->list, &lweventlist); >- spin_unlock_irqrestore(&lweventlist_lock, flags); >- >- if (!test_and_set_bit(LW_RUNNING, &linkwatch_flags)) { >- unsigned long delay = linkwatch_nextevent - jiffies; >+ linkwatch_add_event(event); >+ } else if (!urgent) >+ return; > >- /* If we wrap around we'll delay it by at most HZ. */ >- if (!delay || delay > HZ) >- schedule_work(&linkwatch_work); >- else >- schedule_delayed_work(&linkwatch_work, delay); >- } >- } >+ linkwatch_schedule_work(urgent); > } > > EXPORT_SYMBOL(linkwatch_fire_event);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 251527
:
288931
|
288941
| 291769