Commit 1350c3f2 authored by Rusty Russell's avatar Rusty Russell Committed by Linus Torvalds

[PATCH] daemonize() calls reparent_to_init cleanup

 This makes daemonize() call reparent_to_init() itself, as long
suggested for 2.5, and fixes the callers so they don't call it again.
Also fixes callers which set current->tty to NULL themselves (also
no longer neccessary).
parent 3c14138b
...@@ -232,7 +232,6 @@ int khvcd(void *unused) ...@@ -232,7 +232,6 @@ int khvcd(void *unused)
int i; int i;
daemonize(); daemonize();
reparent_to_init();
strcpy(current->comm, "khvcd"); strcpy(current->comm, "khvcd");
sigfillset(&current->blocked); sigfillset(&current->blocked);
......
...@@ -1025,7 +1025,6 @@ static int hpc_poll_thread (void *data) ...@@ -1025,7 +1025,6 @@ static int hpc_poll_thread (void *data)
debug ("%s - Entry\n", __FUNCTION__); debug ("%s - Entry\n", __FUNCTION__);
lock_kernel (); lock_kernel ();
daemonize (); daemonize ();
reparent_to_init ();
// New name // New name
strcpy (current->comm, "hpc_poll"); strcpy (current->comm, "hpc_poll");
......
...@@ -2486,7 +2486,6 @@ int md_thread(void * arg) ...@@ -2486,7 +2486,6 @@ int md_thread(void * arg)
*/ */
daemonize(); daemonize();
reparent_to_init();
sprintf(current->comm, thread->name); sprintf(current->comm, thread->name);
current->exit_signal = SIGCHLD; current->exit_signal = SIGCHLD;
......
...@@ -304,7 +304,6 @@ static int write_queue_task(void *data) ...@@ -304,7 +304,6 @@ static int write_queue_task(void *data)
DEBUG(1, "blkmtd: writetask: starting (pid = %d)\n", tsk->pid); DEBUG(1, "blkmtd: writetask: starting (pid = %d)\n", tsk->pid);
daemonize(); daemonize();
strcpy(tsk->comm, "blkmtdd"); strcpy(tsk->comm, "blkmtdd");
tsk->tty = NULL;
spin_lock_irq(&tsk->sigmask_lock); spin_lock_irq(&tsk->sigmask_lock);
sigfillset(&tsk->blocked); sigfillset(&tsk->blocked);
recalc_sigpending(); recalc_sigpending();
......
...@@ -1582,8 +1582,7 @@ static int rtl8139_thread (void *data) ...@@ -1582,8 +1582,7 @@ static int rtl8139_thread (void *data)
struct rtl8139_private *tp = dev->priv; struct rtl8139_private *tp = dev->priv;
unsigned long timeout; unsigned long timeout;
daemonize (); daemonize();
reparent_to_init();
spin_lock_irq(&current->sigmask_lock); spin_lock_irq(&current->sigmask_lock);
sigemptyset(&current->blocked); sigemptyset(&current->blocked);
recalc_sigpending(); recalc_sigpending();
......
...@@ -616,7 +616,6 @@ static int pnp_dock_thread(void * unused) ...@@ -616,7 +616,6 @@ static int pnp_dock_thread(void * unused)
static struct pnp_docking_station_info now; static struct pnp_docking_station_info now;
int docked = -1, d = 0; int docked = -1, d = 0;
daemonize(); daemonize();
reparent_to_init();
strcpy(current->comm, "kpnpbiosd"); strcpy(current->comm, "kpnpbiosd");
while(!unloading && !signal_pending(current)) while(!unloading && !signal_pending(current))
{ {
......
...@@ -1878,7 +1878,6 @@ void scsi_error_handler(void *data) ...@@ -1878,7 +1878,6 @@ void scsi_error_handler(void *data)
*/ */
daemonize(); daemonize();
reparent_to_init();
/* /*
* Set the name of this process. * Set the name of this process.
......
...@@ -309,7 +309,6 @@ static int usb_stor_control_thread(void * __us) ...@@ -309,7 +309,6 @@ static int usb_stor_control_thread(void * __us)
* so get rid of all our resources.. * so get rid of all our resources..
*/ */
daemonize(); daemonize();
reparent_to_init();
/* avoid getting signals */ /* avoid getting signals */
spin_lock_irq(&current->sigmask_lock); spin_lock_irq(&current->sigmask_lock);
......
...@@ -83,7 +83,6 @@ static int jffs2_garbage_collect_thread(void *_c) ...@@ -83,7 +83,6 @@ static int jffs2_garbage_collect_thread(void *_c)
struct jffs2_sb_info *c = _c; struct jffs2_sb_info *c = _c;
daemonize(); daemonize();
current->tty = NULL;
c->gc_task = current; c->gc_task = current;
up(&c->gc_thread_start); up(&c->gc_thread_start);
......
...@@ -2114,7 +2114,6 @@ int jfsIOWait(void *arg) ...@@ -2114,7 +2114,6 @@ int jfsIOWait(void *arg)
lock_kernel(); lock_kernel();
daemonize(); daemonize();
current->tty = NULL;
strcpy(current->comm, "jfsIO"); strcpy(current->comm, "jfsIO");
unlock_kernel(); unlock_kernel();
......
...@@ -2763,7 +2763,6 @@ int jfs_lazycommit(void *arg) ...@@ -2763,7 +2763,6 @@ int jfs_lazycommit(void *arg)
lock_kernel(); lock_kernel();
daemonize(); daemonize();
current->tty = NULL;
strcpy(current->comm, "jfsCommit"); strcpy(current->comm, "jfsCommit");
unlock_kernel(); unlock_kernel();
...@@ -2961,7 +2960,6 @@ int jfs_sync(void *arg) ...@@ -2961,7 +2960,6 @@ int jfs_sync(void *arg)
lock_kernel(); lock_kernel();
daemonize(); daemonize();
current->tty = NULL;
strcpy(current->comm, "jfsSync"); strcpy(current->comm, "jfsSync");
unlock_kernel(); unlock_kernel();
......
...@@ -202,7 +202,6 @@ reclaimer(void *ptr) ...@@ -202,7 +202,6 @@ reclaimer(void *ptr)
struct inode *inode; struct inode *inode;
daemonize(); daemonize();
reparent_to_init();
snprintf(current->comm, sizeof(current->comm), snprintf(current->comm, sizeof(current->comm),
"%s-reclaim", "%s-reclaim",
host->h_name); host->h_name);
......
...@@ -98,7 +98,6 @@ lockd(struct svc_rqst *rqstp) ...@@ -98,7 +98,6 @@ lockd(struct svc_rqst *rqstp)
up(&lockd_start); up(&lockd_start);
daemonize(); daemonize();
reparent_to_init();
sprintf(current->comm, "lockd"); sprintf(current->comm, "lockd");
/* Process request with signals blocked. */ /* Process request with signals blocked. */
......
...@@ -232,6 +232,8 @@ void daemonize(void) ...@@ -232,6 +232,8 @@ void daemonize(void)
exit_files(current); exit_files(current);
current->files = init_task.files; current->files = init_task.files;
atomic_inc(&current->files->count); atomic_inc(&current->files->count);
reparent_to_init();
} }
static void reparent_thread(task_t *p, task_t *reaper, task_t *child_reaper) static void reparent_thread(task_t *p, task_t *reaper, task_t *child_reaper)
......
...@@ -524,7 +524,6 @@ EXPORT_SYMBOL(secure_tcp_sequence_number); ...@@ -524,7 +524,6 @@ EXPORT_SYMBOL(secure_tcp_sequence_number);
EXPORT_SYMBOL(get_random_bytes); EXPORT_SYMBOL(get_random_bytes);
EXPORT_SYMBOL(securebits); EXPORT_SYMBOL(securebits);
EXPORT_SYMBOL(cap_bset); EXPORT_SYMBOL(cap_bset);
EXPORT_SYMBOL(reparent_to_init);
EXPORT_SYMBOL(daemonize); EXPORT_SYMBOL(daemonize);
EXPORT_SYMBOL(csum_partial); /* for networking and md */ EXPORT_SYMBOL(csum_partial); /* for networking and md */
EXPORT_SYMBOL(seq_escape); EXPORT_SYMBOL(seq_escape);
......
...@@ -88,7 +88,6 @@ struct pdflush_work { ...@@ -88,7 +88,6 @@ struct pdflush_work {
static int __pdflush(struct pdflush_work *my_work) static int __pdflush(struct pdflush_work *my_work)
{ {
daemonize(); daemonize();
reparent_to_init();
strcpy(current->comm, "pdflush"); strcpy(current->comm, "pdflush");
/* interruptible sleep, so block all signals */ /* interruptible sleep, so block all signals */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment