* [PATCH] Allow raw_notifier callouts to unregister themselves
@ 2006-05-11 18:00 Alan Stern
2006-05-11 18:25 ` Andrew Morton
0 siblings, 1 reply; 5+ messages in thread
From: Alan Stern @ 2006-05-11 18:00 UTC (permalink / raw)
To: Andrew Morton; +Cc: Chandra Seetharaman, Jes Sorensen, Kernel development list
Since raw_notifier chains don't benefit from any centralized locking
protections, they shouldn't suffer from the associated limitations.
Under some circumstances it might make sense for a raw_notifier callout
routine to unregister itself from the notifier chain. This patch (as678)
changes the notifier core to allow for such things.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
---
Index: linux-2.6.17-rc3/kernel/sys.c
===================================================================
--- linux-2.6.17-rc3.orig/kernel/sys.c
+++ linux-2.6.17-rc3/kernel/sys.c
@@ -132,14 +132,15 @@ static int __kprobes notifier_call_chain
unsigned long val, void *v)
{
int ret = NOTIFY_DONE;
- struct notifier_block *nb;
+ struct notifier_block *nb, *next_nb;
nb = rcu_dereference(*nl);
while (nb) {
+ next_nb = rcu_dereference(nb->next);
ret = nb->notifier_call(nb, val, v);
if ((ret & NOTIFY_STOP_MASK) == NOTIFY_STOP_MASK)
break;
- nb = rcu_dereference(nb->next);
+ nb = next_nb;
}
return ret;
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Allow raw_notifier callouts to unregister themselves
2006-05-11 18:00 [PATCH] Allow raw_notifier callouts to unregister themselves Alan Stern
@ 2006-05-11 18:25 ` Andrew Morton
2006-05-11 18:35 ` Alan Stern
2006-05-11 18:57 ` David S. Miller
0 siblings, 2 replies; 5+ messages in thread
From: Andrew Morton @ 2006-05-11 18:25 UTC (permalink / raw)
To: Alan Stern; +Cc: sekharan, jes, linux-kernel
Alan Stern <stern@rowland.harvard.edu> wrote:
>
> Since raw_notifier chains don't benefit from any centralized locking
> protections, they shouldn't suffer from the associated limitations.
> Under some circumstances it might make sense for a raw_notifier callout
> routine to unregister itself from the notifier chain. This patch (as678)
> changes the notifier core to allow for such things.
ok... Can you see any reason why 2.6.17 needs this?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Allow raw_notifier callouts to unregister themselves
2006-05-11 18:25 ` Andrew Morton
@ 2006-05-11 18:35 ` Alan Stern
2006-05-11 18:57 ` David S. Miller
1 sibling, 0 replies; 5+ messages in thread
From: Alan Stern @ 2006-05-11 18:35 UTC (permalink / raw)
To: Andrew Morton; +Cc: sekharan, jes, linux-kernel
On Thu, 11 May 2006, Andrew Morton wrote:
> Alan Stern <stern@rowland.harvard.edu> wrote:
> >
> > Since raw_notifier chains don't benefit from any centralized locking
> > protections, they shouldn't suffer from the associated limitations.
> > Under some circumstances it might make sense for a raw_notifier callout
> > routine to unregister itself from the notifier chain. This patch (as678)
> > changes the notifier core to allow for such things.
>
> ok... Can you see any reason why 2.6.17 needs this?
No. The patch was submitted in preparation for some work that Jes
Sorensen is doing on task notifiers. It definitely is not needed
immediately.
Alan Stern
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Allow raw_notifier callouts to unregister themselves
2006-05-11 18:25 ` Andrew Morton
2006-05-11 18:35 ` Alan Stern
@ 2006-05-11 18:57 ` David S. Miller
2006-05-16 15:41 ` Alan Stern
1 sibling, 1 reply; 5+ messages in thread
From: David S. Miller @ 2006-05-11 18:57 UTC (permalink / raw)
To: akpm; +Cc: stern, sekharan, jes, linux-kernel
From: Andrew Morton <akpm@osdl.org>
Date: Thu, 11 May 2006 11:25:09 -0700
> Alan Stern <stern@rowland.harvard.edu> wrote:
> >
> > Since raw_notifier chains don't benefit from any centralized locking
> > protections, they shouldn't suffer from the associated limitations.
> > Under some circumstances it might make sense for a raw_notifier callout
> > routine to unregister itself from the notifier chain. This patch (as678)
> > changes the notifier core to allow for such things.
>
> ok... Can you see any reason why 2.6.17 needs this?
If this patch makes raw notifiers behave more closely to the
way notifiers did before the notifier patch went into 2.6.17,
we should seriouly consider it. We've had enough regressions
from that patch, and anything which minimizes any possible other
such regressions would be a plus.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Allow raw_notifier callouts to unregister themselves
2006-05-11 18:57 ` David S. Miller
@ 2006-05-16 15:41 ` Alan Stern
0 siblings, 0 replies; 5+ messages in thread
From: Alan Stern @ 2006-05-16 15:41 UTC (permalink / raw)
To: David S. Miller; +Cc: akpm, sekharan, jes, linux-kernel
On Thu, 11 May 2006, David S. Miller wrote:
> From: Andrew Morton <akpm@osdl.org>
> Date: Thu, 11 May 2006 11:25:09 -0700
>
> > Alan Stern <stern@rowland.harvard.edu> wrote:
> > >
> > > Since raw_notifier chains don't benefit from any centralized locking
> > > protections, they shouldn't suffer from the associated limitations.
> > > Under some circumstances it might make sense for a raw_notifier callout
> > > routine to unregister itself from the notifier chain. This patch (as678)
> > > changes the notifier core to allow for such things.
> >
> > ok... Can you see any reason why 2.6.17 needs this?
>
> If this patch makes raw notifiers behave more closely to the
> way notifiers did before the notifier patch went into 2.6.17,
> we should seriouly consider it. We've had enough regressions
> from that patch, and anything which minimizes any possible other
> such regressions would be a plus.
Sorry I'm a little late replying to this...
Actually this patch makes raw notifiers behave a little _less_ like the
original pre-2.6.17 notifiers. With the original code, a notifier callout
routine could unregister itself and deallocate its notifier_block, thereby
causing an oops when it returned. With this patch, the oops will not
occur.
That's the only difference.
Alan Stern
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-05-16 15:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-11 18:00 [PATCH] Allow raw_notifier callouts to unregister themselves Alan Stern
2006-05-11 18:25 ` Andrew Morton
2006-05-11 18:35 ` Alan Stern
2006-05-11 18:57 ` David S. Miller
2006-05-16 15:41 ` Alan Stern
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®