On Thu, Sep 29, 2005 at 10:12:06AM -0500, Erik Jacobson wrote:
> > __pnotify_exit() would need to call the exit callback for all clients
> > except for the client failing the fork call. To do this wouldn't the
> > following be needed in __pnotify_fork()?
>
> If the fork fails in copy_process, we go to cleanup in copy_process,
> not exit.c. So, with the revision, if the the pnotify kernel module
> subscriber returns a failure for the process, that failure is passed
> along to the copy_process call. There, we go to bad_fork_cleanup_namespace
> where a pnotify_exit is done on the process that failed to fork.
>
> In the old version, the pnotify_exit would have also been run within
> __pnotify_fork. In the new version, we don't run the pnotify_exit
> from __pnotify_fork because we know it will be run in the fork failure
> path of copy_process. That should mean that pnotify_exit will only
> execute once. I think that means that your suggestion for adding
> a pnotify_unsubscribe isn't necessary? The unsubscribe is done by
> __pnotify_exit in this case. Or am I still missing the point here?
> Sorry if it isn't getting through my head.
That's okay. I've taken a look at the test version and it doesn't
seem like its doing what I suggested, so let me try again.
My suggestion is that the unsubscribe exit callback should only be
done for clients who successfully subscribed. For example, during a
fork:
1. Client A subscribes with its subscriber->events->fork() being
successful.
2. Client B subscribes with its subscriber->events->fork() being
successful.
3. Client C fails the fork and its subscriber->events->fork() returns
a failure. Client C has its subscription removed from the pnotify
list but its subscriber->events->exit() callback should not be called.
4. Client A & B are unsubscribed and their subscriber->events->exit()
callbacks are invoked.
Right now, AFAICS, client C would have its subscriber->events->exit()
callback invoked in spite of a failure. IMHO the exit() callback
should only ever be called for a client for whom its fork() callback
succeeded. What do you think?
>
> See the RCU test version of pnotify in the download site under
> pnotify-test. My attempts at posting that patch to the list seem to be
> eaten by the list server right now. When that's fixed, I'll start posting
> stuff here.
>
> Erik
Thanks,
--
Kingsley
|