* New rtl8139 driver prevents ssh from exiting.
@ 2001-05-01 12:41 Rob Landley
2001-05-01 13:32 ` Andrew Morton
0 siblings, 1 reply; 4+ messages in thread
From: Rob Landley @ 2001-05-01 12:41 UTC (permalink / raw)
To: linux-kernel
The kernel thread the new rtl8139 driver spawns
apparently wants to write to stdout, because it counts
as an unfinished process that prevents an ssh session
from exiting.
I have a script that remotely reconfigures subnets in
a vpn, which gets run via an ssh in through eth0 and
does, among other things:
ifconfig eth1 down
ifconfig eth1 up
Hence kicking off the thread. I have to run "killall
eth1" at the end of the script to make ssh exit.
(This doesn't seem to have any negative impact on
eth1's functioning.)
Anybody feel like shedding light on this?
Rob
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: New rtl8139 driver prevents ssh from exiting.
2001-05-01 12:41 New rtl8139 driver prevents ssh from exiting Rob Landley
@ 2001-05-01 13:32 ` Andrew Morton
2001-05-01 13:50 ` Rob Landley
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2001-05-01 13:32 UTC (permalink / raw)
To: Rob Landley; +Cc: linux-kernel
Rob Landley wrote:
>
> The kernel thread the new rtl8139 driver spawns
> apparently wants to write to stdout, because it counts
> as an unfinished process that prevents an ssh session
> from exiting.
Does this help?
--- linux-2.4.4-pre3/kernel/sched.c Sun Apr 15 15:34:25 2001
+++ linux-akpm/kernel/sched.c Mon Apr 16 20:40:47 2001
@@ -32,6 +32,7 @@
extern void timer_bh(void);
extern void tqueue_bh(void);
extern void immediate_bh(void);
+extern struct task_struct *child_reaper;
/*
* scheduler variables
@@ -1260,32 +1261,53 @@
/*
* Put all the gunge required to become a kernel thread without
* attached user resources in one place where it belongs.
+ *
+ * Kernel 2.4.4-pre3, andrewm#uow.edu.au: reparent the caller
+ * to init and set the exit signal to SIGCHLD so the thread
+ * will be properly reaped if it exist.
*/
void daemonize(void)
{
struct fs_struct *fs;
-
+ struct task_struct *this_task = current;
/*
* If we were started as result of loading a module, close all of the
* user space pages. We don't need them, and if we didn't close them
* they would be locked into memory.
*/
- exit_mm(current);
+ exit_mm(this_task);
- current->session = 1;
- current->pgrp = 1;
+ this_task->session = 1;
+ this_task->pgrp = 1;
/* Become as one with the init task */
- exit_fs(current); /* current->fs->count--; */
+ exit_fs(this_task); /* this_task->fs->count--; */
fs = init_task.fs;
- current->fs = fs;
+ this_task->fs = fs;
atomic_inc(&fs->count);
- exit_files(current);
- current->files = init_task.files;
- atomic_inc(¤t->files->count);
+ exit_files(this_task); /* this_task->files->count-- */
+ this_task->files = init_task.files;
+ atomic_inc(&this_task->files->count);
+
+ write_lock_irq(&tasklist_lock);
+
+ /* Reparent to init */
+ REMOVE_LINKS(this_task);
+ this_task->p_pptr = child_reaper;
+ this_task->p_opptr = child_reaper;
+ SET_LINKS(this_task);
+
+ /* Set the exit signal to SIGCHLD so we signal init on exit */
+ if (this_task->exit_signal != 0) {
+ printk(KERN_ERR "task `%s' exit_signal %d in daemonize()\n",
+ this_task->comm, this_task->exit_signal);
+ }
+ this_task->exit_signal = SIGCHLD;
+
+ write_unlock_irq(&tasklist_lock);
}
void __init init_idle(void)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: New rtl8139 driver prevents ssh from exiting.
2001-05-01 13:32 ` Andrew Morton
@ 2001-05-01 13:50 ` Rob Landley
0 siblings, 0 replies; 4+ messages in thread
From: Rob Landley @ 2001-05-01 13:50 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel
--- Andrew Morton <andrewm@uow.edu.au> wrote:
> Rob Landley wrote:
> >
> > The kernel thread the new rtl8139 driver spawns
> > apparently wants to write to stdout, because it
> counts
> > as an unfinished process that prevents an ssh
> session
> > from exiting.
>
> Does this help?
--- Andrew Morton <andrewm@uow.edu.au> wrote:
> Rob Landley wrote:
> >
> > The kernel thread the new rtl8139 driver spawns
> > apparently wants to write to stdout, because it
> counts
> > as an unfinished process that prevents an ssh
> session
> > from exiting.
>
> Does this help?
Assuming this applies cleanly against 2.2.19
(production box; 2.4.3 wasn't ready and 2.4.4 wasn't
available when the first prototypes had to go to
test), I'll let you know in about an hour.
Thanks,
Rob
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: New rtl8139 driver prevents ssh from exiting.
[not found] <3AEEC189.5D953AC3@uow.edu.au>
@ 2001-05-01 14:55 ` Rob Landley
0 siblings, 0 replies; 4+ messages in thread
From: Rob Landley @ 2001-05-01 14:55 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 449 bytes --]
--- Andrew Morton <andrewm@uow.edu.au> wrote:
> ack. You never said 2.2.19 :(
>
> It won't apply...
No, but this one did. (Never underestimate the power
of somebody with source code, a text editor, and the
willingness to totally hose their system.)
And it fixed the problem. Thank you.
Rob
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/
[-- Attachment #2: patch-2.2.19 --]
[-- Type: application/x-unknown, Size: 2203 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-05-01 14:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-05-01 12:41 New rtl8139 driver prevents ssh from exiting Rob Landley
2001-05-01 13:32 ` Andrew Morton
2001-05-01 13:50 ` Rob Landley
[not found] <3AEEC189.5D953AC3@uow.edu.au>
2001-05-01 14:55 ` Rob Landley
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.