OpenVZ Forum - RDF feed
type: channel
items: Remaining straight forward kthread API conversions...
items: [PATCH] i386 balance_irq: Convert to the kthread api.
items: [PATCH] i386 voyager: Convert the monitor thread to use the kthread API
items: [PATCH] mtd_blkdevs: Convert to use the kthread API
items: [PATCH] cpci_hotplug: Convert to use the kthread API
items: [PATCH] ibmphp: Convert to use the kthreads API
items: [PATCH] cpqphp: Convert to use the kthread API
items: [PATCH] pnpbios: Conert to use the kthread API.
items: [PATCH] sas_scsi_host: Convert to use the kthread API
items: [PATCH] sparc64/power.c: Convert to use the kthread API
items: [PATCH] s390/net/lcs: Convert to the kthread API
items: [PATCH] s390 qeth: Convert to use the kthread API
items: [PATCH] s390/scsi/zfcp_erp: Convert to use the kthread API
items: [PATCH] arm ecard: Conver to use the kthread API.
items: [PATCH] ia64 sn xpc: Convert to use kthread API.
items: [PATCH] powerpc pseries eeh: Convert to kthread API
items: [PATCH] powerpc pseries rtasd: Convert to kthread API.
items: [PATCH] macintosh/therm_pm72.c: Convert to kthread API.
items: [PATCH] macintosh/therm_windtunnel.c: Convert to kthread API.
items: [PATCH] macintosh/adb: Convert to the kthread API
items: [PATCH] macintosh/mediabay: Convert to kthread API.
items: [PATCH] bluetooth bnep: Convert to kthread API.
items: [PATCH] bluetooth cmtp: Convert to use kthread API.
items: [PATCH] bluetooth hidp: Convert to kthread API.
items: [PATCH] bluetooth rfcomm: Convert to kthread API.
items: [PATCH] fs/afs: Convert to kthread API.
items: [PATCH] net/rxrpc: Convert to kthread API.
items: [PATCH] ipv4/ipvs: Convert to kthread API
items: [PATCH] saa7134-tvaudio: Convert to kthread API.
items: [PATCH] nfs lockd reclaimer: Convert to kthread API
items: [PATCH] nfsv4 delegation: Convert to kthread API
items: [PATCH] nfsd/nfs4state: Remove unnecessary daemonize call.
items: [PATCH] nfs4state reclaimer: Remove unnecessary allow_signal
items: [PATCH] smbfs: Remove unnecessary allow_signal
items: [PATCH] dvb_en_50221: Convert to kthread API
items: [PATCH] md: Remove broken SIGKILL support
items: [PATCH] synchro_test: Convert to the kthread API.
items: Re: [PATCH] s390/net/lcs: Convert to the kthread API
items: Re: [PATCH] ipv4/ipvs: Convert to kthread API
items: Re: [PATCH] fs/afs: Convert to kthread API.

Remaining straight forward kthread API conversions...
type: item
description: The following patches are against 2.6.21.rc6-mm1. Hopefully that is enough to catch most of the recent development activity. I am aiming to remove all kernel threads that handle signals from user space, to remove all calls to daemonize and kernel_thread from non-core kernel code. kernel thrreads handling signals from user space is a problem because it makes the kernel thread part of the user/kernel API which make changing things difficult and it breaks as soon as you are inside of a pid namespace because you won't be able to see your kernel thread. Calling kernel_thread has problems because it returns a pid_t value which once we get to the pid namespace is context depending so it cannot be used to globally identify a process. kernel_thread is also a problem because it traps user space state and requires us to call daemonize to free that state. daemonize is a maintenance problem because every time you play with user space state and limiting things you need to remember to update daemonize. Occasionally it has taken years like in the case of the mount namespace before someone realizes they need to update it. With the kthread api we no longer need daemonize. In addition we don't want kernel threads visible in anything but the initial pid namespace or they will hold a reference to a child pid namespace. However calling kernel_thread from a non-kernel parent in a child pid namespace will give the thread a pid in the child pid namespace, and there is nothing daemonize can do about it. So daemonize appears impossible to support going forward, and I choose to remove all of it's callers rather than attempt to support it. Eric _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T06:52:28-00:00

[PATCH] i386 balance_irq: Convert to the kthread api.
type: item
description: This patch just trivial converts from calling kernel_thread and daemonize to just calling kthread_run. Cc: Andi Kleen <ak@suse.de> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- arch/i386/kernel/io_apic.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c index 24ac67c..84b412a 100644 --- a/arch/i386/kernel/io_apic.c +++ b/arch/i386/kernel/io_apic.c @@ -34,6 +34,7 @@ #include <linux/msi.h> #include <linux/htirq.h> #include <linux/freezer.h> +#include <linux/kthread.h> #include <asm/io.h> #include <asm/smp.h> @@ -660,8 +661,6 @@ static int balanced_irq(void *unused) unsigned long prev_balance_time = jiffies; long time_remaining = balanced_irq_interval; - daemonize("kirqd"); - /* push everything to CPU 0 to give us a starting point. */ for (i = 0 ; i < NR_IRQS ; i++) { irq_desc[i].pending_mask = cpumask_of_cpu(0); @@ -721,7 +720,7 @@ static int __init balanced_irq_init(void) } printk(KERN_INFO "Starting balanced_irq\n"); - if (kernel_thread(balanced_irq, NULL, CLONE_KERNEL) >= 0) + if (!IS_ERR(kthread_run(balanced_irq, NULL, "kirqd"))) return 0; else printk(KERN_ERR "balanced_irq_init: failed to spawn balanced_irq"); -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T06:55:26-00:00

[PATCH] i386 voyager: Convert the monitor thread to use the kthread API
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted This patch just trivially replaces kernel_thread and daemonize with a single call to kthread_run. CC: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- arch/i386/mach-voyager/voyager_thread.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/i386/mach-voyager/voyager_thread.c b/arch/i386/mach-voyager/voyager_thread.c index ebfd913..ee23d9b 100644 --- a/arch/i386/mach-voyager/voyager_thread.c +++ b/arch/i386/mach-voyager/voyager_thread.c @@ -23,6 +23,7 @@ #include <linux/kmod.h> #include <linux/completion.h> #include <linux/sched.h> +#include <linux/kthread.h> #include <asm/desc.h> #include <asm/voyager.h> #include <asm/vic.h> @@ -43,7 +44,7 @@ static __u8 set_timeout = 0; static int __init voyager_thread_start(void) { - if(kernel_thread(thread, NULL, CLONE_KERNEL) < 0) { + if (IS_ERR(kthread_run(thread, NULL, "%s", THREAD_NAME))) { /* This is serious, but not fatal */ printk(KERN_ERR "Voyager: Failed to create system monitor thread!!!\n"); return 1; @@ -122,8 +123,6 @@ thread(void *unused) kvoyagerd_running = 1; - daemonize(THREAD_NAME); - set_timeout = 0; init_timer(&wakeup_timer); -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T06:55:27-00:00

[PATCH] mtd_blkdevs: Convert to use the kthread API
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted thread_run is used intead of kernel_thread, daemonize, and mucking around blocking signals directly. CC: David Woodhouse <dwmw2@infradead.org> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/mtd/mtd_blkdevs.c | 19 +++++-------------- 1 files changed, 5 insertions(+), 14 deletions(-) diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c index db7397c..ed71d5e 100644 --- a/drivers/mtd/mtd_blkdevs.c +++ b/drivers/mtd/mtd_blkdevs.c @@ -21,6 +21,7 @@ #include <linux/init.h> #include <linux/mutex.h> #include <linux/freezer.h> +#include <linux/kthread.h> #include <asm/uaccess.h> static LIST_HEAD(blktrans_majors); @@ -84,17 +85,6 @@ static int mtd_blktrans_thread(void *arg) /* we might get involved when memory gets low, so use PF_MEMALLOC */ current->flags |= PF_MEMALLOC | PF_NOFREEZE; - daemonize("%sd", tr->name); - - /* daemonize() doesn't do this for us since some kernel threads - actually want to deal with signals. We can't just call - exit_sighand() since that'll cause an oops when we finally - do exit. */ - spin_lock_irq(&current->sighand->siglock); - sigfillset(&current->blocked); - recalc_sigpending(); - spin_unlock_irq(&current->sighand->siglock); - spin_lock_irq(rq->queue_lock); while (!tr->blkcore_priv->exiting) { @@ -368,6 +358,7 @@ static struct mtd_notifier blktrans_notifier = { int register_mtd_blktrans(struct mtd_blktrans_ops *tr) { + struct task_struct *task; int ret, i; /* Register the notifier if/when the first device type is @@ -406,13 +397,13 @@ int register_mtd_blktrans(struct mtd_blktrans_ops *tr) blk_queue_hardsect_size(tr->blkcore_priv->rq, tr->blksize); tr->blkshift = ffs(tr->blksize) - 1; - ret = kernel_thread(mtd_blktrans_thread, tr, CLONE_KERNEL); - if (ret < 0) { + task = kthread_run(mtd_blktrans_thread, tr, "%sd", tr->name); + if (IS_ERR(task)) { blk_cleanup_queue(tr->blkcore_priv->rq); unregister_blkdev(tr->major, tr->name); kfree(tr->blkcore_priv); m…
creator: ebiederm
date: 2007-04-19T06:55:28-00:00

[PATCH] cpci_hotplug: Convert to use the kthread API
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted kthread_run replaces the kernel_thread and daemonize calls during thread startup. Calls to signal_pending were also removed as it is currently impossible for the cpci_hotplug thread to receive signals. CC: Scott Murray <scottm@somanetworks.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/pci/hotplug/cpci_hotplug_core.c | 22 +++++++--------------- 1 files changed, 7 insertions(+), 15 deletions(-) diff --git a/drivers/pci/hotplug/cpci_hotplug_core.c b/drivers/pci/hotplug/cpci_hotplug_core.c index 6845515..c620c7e 100644 --- a/drivers/pci/hotplug/cpci_hotplug_core.c +++ b/drivers/pci/hotplug/cpci_hotplug_core.c @@ -33,6 +33,7 @@ #include <linux/init.h> #include <linux/interrupt.h> #include <linux/smp_lock.h> +#include <linux/kthread.h> #include <asm/atomic.h> #include <linux/delay.h> #include "cpci_hotplug.h" @@ -521,17 +522,13 @@ event_thread(void *data) { int rc; - lock_kernel(); - daemonize("cpci_hp_eventd"); - unlock_kernel(); - dbg("%s - event thread started", __FUNCTION__); while (1) { dbg("event thread sleeping"); down_interruptible(&event_semaphore); dbg("event thread woken, thread_finished = %d", thread_finished); - if (thread_finished || signal_pending(current)) + if (thread_finished) break; do { rc = check_slots(); @@ -562,12 +559,8 @@ poll_thread(void *data) { int rc; - lock_kernel(); - daemonize("cpci_hp_polld"); - unlock_kernel(); - while (1) { - if (thread_finished || signal_pending(current)) + if (thread_finished) break; if (controller->ops->query_enum()) { do { @@ -592,7 +585,7 @@ poll_thread(void *data) static int cpci_start_thread(void) { - int pid; + struct task_struct *task; /* initialize our semaphores */ init_MUTEX_LOCKED(&event_semaphore); @@ -600,14 +593,13 @@ cpci_start_thread(void) thread_finished = 0; if (controller->irq) - pid = kernel_thread(event_thread, NULL, 0); + task = kthread_run(event_thread, NULL, "cpci_hp_eventd"); else - pid = kernel_thread(poll_t…
creator: ebiederm
date: 2007-04-19T06:55:29-00:00

[PATCH] ibmphp: Convert to use the kthreads API
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted kthread_run replaces kernel_thread and dameonize. allow_signal is unnecessary and has been removed. tid_poll was unused and has been removed. Cc: Jyoti Shah <jshah@us.ibm.com> Cc: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/pci/hotplug/ibmphp_hpc.c | 14 +++++--------- 1 files changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/pci/hotplug/ibmphp_hpc.c b/drivers/pci/hotplug/ibmphp_hpc.c index 46abaa8..27e12f1 100644 --- a/drivers/pci/hotplug/ibmphp_hpc.c +++ b/drivers/pci/hotplug/ibmphp_hpc.c @@ -34,6 +34,7 @@ #include <linux/pci.h> #include <linux/init.h> #include <linux/mutex.h> +#include <linux/kthread.h> #include "ibmphp.h" @@ -101,7 +102,6 @@ static int to_debug = 0; // global variables //---------------------------------------------------------------------------- static int ibmphp_shutdown; -static int tid_poll; static struct mutex sem_hpcaccess; // lock access to HPC static struct semaphore semOperations; // lock all operations and // access to data structures @@ -137,7 +137,6 @@ void __init ibmphp_hpc_initvars (void) init_MUTEX_LOCKED (&sem_exit); to_debug = 0; ibmphp_shutdown = 0; - tid_poll = 0; debug ("%s - Exit\n", __FUNCTION__); } @@ -1060,12 +1059,8 @@ static int hpc_poll_thread (void *data) { debug ("%s - Entry\n", __FUNCTION__); - daemonize("hpc_poll"); - allow_signal(SIGKILL); - poll_hpc (); - tid_poll = 0; debug ("%s - Exit\n", __FUNCTION__); return 0; } @@ -1078,17 +1073,18 @@ static int hpc_poll_thread (void *data) *---------------------------------------------------------------------*/ int __init ibmphp_hpc_start_poll_thread (void) { + struct task_struct *task; int rc = 0; debug ("%s - Entry\n", __FUNCTION__); - tid_poll = kernel_thread (hpc_poll_thread, NULL, 0); - if (tid_poll < 0) { + task = kthread_run(hpc_poll_thread, NULL, "hpc_poll"); + if (IS_ERR(task)) { err ("%s - Error, thread not started\n", __FUNCTION__); …
creator: ebiederm
date: 2007-04-19T06:55:30-00:00

[PATCH] cpqphp: Convert to use the kthread API
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted This patch changes cpqphp to use kthread_run and not kernel_thread and daemonize to startup and setup the cpqphp thread. Cc: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/pci/hotplug/cpqphp_ctrl.c | 12 ++++-------- 1 files changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c index 79ff6b4..c2c06c4 100644 --- a/drivers/pci/hotplug/cpqphp_ctrl.c +++ b/drivers/pci/hotplug/cpqphp_ctrl.c @@ -37,6 +37,7 @@ #include <linux/smp_lock.h> #include <linux/pci.h> #include <linux/pci_hotplug.h> +#include <linux/kthread.h> #include "cpqphp.h" static u32 configure_new_device(struct controller* ctrl, struct pci_func *func, @@ -1746,10 +1747,6 @@ static void pushbutton_helper_thread(unsigned long data) static int event_thread(void* data) { struct controller *ctrl; - lock_kernel(); - daemonize("phpd_event"); - - unlock_kernel(); while (1) { dbg("!!!!event_thread sleeping\n"); @@ -1771,7 +1768,7 @@ static int event_thread(void* data) int cpqhp_event_start_thread(void) { - int pid; + struct task_struct *task; /* initialize our semaphores */ init_MUTEX(&delay_sem); @@ -1779,12 +1776,11 @@ int cpqhp_event_start_thread(void) init_MUTEX_LOCKED(&event_exit); event_finished=0; - pid = kernel_thread(event_thread, NULL, 0); - if (pid < 0) { + task = kthread_run(event_thread, NULL, "phpd_event"); + if (IS_ERR(task)) { err ("Can't start up our event thread\n"); return -1; } - dbg("Our event thread pid = %d\n", pid); return 0; } -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T06:55:31-00:00

[PATCH] pnpbios: Conert to use the kthread API.
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted This patches modifies the pnpbios kernel thread to start with ktrhead_run not kernel_thread and deamonize. Doing this makes the code a little simpler and easier to maintain. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/pnp/pnpbios/core.c | 16 +++++++--------- 1 files changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c index c2ed53f..3a201b7 100644 --- a/drivers/pnp/pnpbios/core.c +++ b/drivers/pnp/pnpbios/core.c @@ -62,6 +62,7 @@ #include <linux/delay.h> #include <linux/acpi.h> #include <linux/freezer.h> +#include <linux/kthread.h> #include <asm/page.h> #include <asm/desc.h> @@ -159,9 +160,7 @@ static int pnp_dock_thread(void * unused) { static struct pnp_docking_station_info now; int docked = -1, d = 0; - daemonize("kpnpbiosd"); - allow_signal(SIGKILL); - while(!unloading && !signal_pending(current)) + while (!unloading) { int status; @@ -170,11 +169,8 @@ static int pnp_dock_thread(void * unused) */ msleep_interruptible(2000); - if(signal_pending(current)) { - if (try_to_freeze()) - continue; - break; - } + if (try_to_freeze()) + continue; status = pnp_bios_dock_station_info(&now); @@ -582,6 +578,7 @@ subsys_initcall(pnpbios_init); static int __init pnpbios_thread_init(void) { + struct task_struct *task; #if defined(CONFIG_PPC_MERGE) if (check_legacy_ioport(PNPBIOS_BASE)) return 0; @@ -590,7 +587,8 @@ static int __init pnpbios_thread_init(void) return 0; #ifdef CONFIG_HOTPLUG init_completion(&unload_sem); - if (kernel_thread(pnp_dock_thread, NULL, CLONE_KERNEL) > 0) + task = kthread_run(pnp_dock_thread, NULL, "kpnpbiosd"); + if (!IS_ERR(task)) unloading = 0; #endif return 0; -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T06:55:32-00:00

[PATCH] sas_scsi_host: Convert to use the kthread API
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted This patch modifies the sas scsi host thread startup to use kthread_run not kernel_thread and deamonize. kthread_run is slightly simpler and more maintainable. Cc: Darrick J. Wong <djwong@us.ibm.com> Cc: James Bottomley <James.Bottomley@SteelEye.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/scsi/libsas/sas_scsi_host.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c index 46ba3a7..7a38ac5 100644 --- a/drivers/scsi/libsas/sas_scsi_host.c +++ b/drivers/scsi/libsas/sas_scsi_host.c @@ -40,6 +40,7 @@ #include <linux/blkdev.h> #include <linux/scatterlist.h> #include <linux/freezer.h> +#include <linux/kthread.h> /* ---------- SCSI Host glue ---------- */ @@ -870,7 +871,6 @@ static int sas_queue_thread(void *_sas_ha) struct sas_ha_struct *sas_ha = _sas_ha; struct scsi_core *core = &sas_ha->core; - daemonize("sas_queue_%d", core->shost->host_no); current->flags |= PF_NOFREEZE; complete(&queue_th_comp); @@ -891,19 +891,20 @@ static int sas_queue_thread(void *_sas_ha) int sas_init_queue(struct sas_ha_struct *sas_ha) { - int res; struct scsi_core *core = &sas_ha->core; + struct task_struct *task; spin_lock_init(&core->task_queue_lock); core->task_queue_size = 0; INIT_LIST_HEAD(&core->task_queue); init_MUTEX_LOCKED(&core->queue_thread_sema); - res = kernel_thread(sas_queue_thread, sas_ha, 0); - if (res >= 0) + task = kthread_run(sas_queue_thread, sas_ha, + "sas_queue_%d", core->shost->host_no); + if (!IS_ERR(task)) wait_for_completion(&queue_th_comp); - return res < 0 ? res : 0; + return IS_ERR(task) ? PTR_ERR(task) : 0; } void sas_shutdown_queue(struct sas_ha_struct *sas_ha) -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T06:55:33-00:00

[PATCH] sparc64/power.c: Convert to use the kthread API
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted This starts the sparc64 powerd using kthread_run instead of kernel_thread and daemonize. Making the code slightly simpler and more maintainable. In addition the unnecessary flush_signals is removed. Cc: David S. Miller <davem@davemloft.net> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- arch/sparc64/kernel/power.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/sparc64/kernel/power.c b/arch/sparc64/kernel/power.c index 699b24b..03feb8b 100644 --- a/arch/sparc64/kernel/power.c +++ b/arch/sparc64/kernel/power.c @@ -13,6 +13,7 @@ #include <linux/interrupt.h> #include <linux/pm.h> #include <linux/syscalls.h> +#include <linux/kthread.h> #include <asm/system.h> #include <asm/auxio.h> @@ -81,15 +82,12 @@ static int powerd(void *__unused) char *argv[] = { "/sbin/shutdown", "-h", "now", NULL }; DECLARE_WAITQUEUE(wait, current); - daemonize("powerd"); - add_wait_queue(&powerd_wait, &wait); again: for (;;) { set_task_state(current, TASK_INTERRUPTIBLE); if (button_pressed) break; - flush_signals(current); schedule(); } __set_current_state(TASK_RUNNING); @@ -128,7 +126,9 @@ static int __devinit power_probe(struct of_device *op, const struct of_device_id poweroff_method = machine_halt; /* able to use the standard halt */ if (has_button_interrupt(irq, op->node)) { - if (kernel_thread(powerd, NULL, CLONE_FS) < 0) { + struct task_struct *task; + task = kthread_urn(powerd, NULL, "powerd"); + if (IS_ERR(task)) { printk("Failed to start power daemon.\n"); return 0; } -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T06:55:34-00:00

[PATCH] s390/net/lcs: Convert to the kthread API
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted Use kthread_run to start the lcs kernel threads not a combination of kernel_thread and daemonize. This makes the code slightly simpler and more maintainable. Cc: Frank Pavlic <fpavlic@de.ibm.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/s390/net/lcs.c | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c index 08a994f..0300d87 100644 --- a/drivers/s390/net/lcs.c +++ b/drivers/s390/net/lcs.c @@ -36,6 +36,7 @@ #include <linux/in.h> #include <linux/igmp.h> #include <linux/delay.h> +#include <linux/kthread.h> #include <net/arp.h> #include <net/ip.h> @@ -1248,7 +1249,6 @@ lcs_register_mc_addresses(void *data) struct in_device *in4_dev; card = (struct lcs_card *) data; - daemonize("regipm"); if (!lcs_do_run_thread(card, LCS_SET_MC_THREAD)) return 0; @@ -1728,11 +1728,10 @@ lcs_start_kernel_thread(struct work_struct *work) struct lcs_card *card = container_of(work, struct lcs_card, kernel_thread_starter); LCS_DBF_TEXT(5, trace, "krnthrd"); if (lcs_do_start_thread(card, LCS_RECOVERY_THREAD)) - kernel_thread(lcs_recovery, (void *) card, SIGCHLD); + kthread_run(lcs_recovery, card, "lcs_recover"); #ifdef CONFIG_IP_MULTICAST if (lcs_do_start_thread(card, LCS_SET_MC_THREAD)) - kernel_thread(lcs_register_mc_addresses, - (void *) card, SIGCHLD); + kernel_run(lcs_register_mc_addresses, card, "regipm"); #endif } @@ -2232,7 +2231,6 @@ lcs_recovery(void *ptr) int rc; card = (struct lcs_card *) ptr; - daemonize("lcs_recover"); LCS_DBF_TEXT(4, trace, "recover1"); if (!lcs_do_run_thread(card, LCS_RECOVERY_THREAD)) -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T06:55:35-00:00

[PATCH] s390 qeth: Convert to use the kthread API
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted This patch modifies the qeth_recover thread to be started with kthread_run not a combination of kernel_thread and daemonize. Resulting in slightly simpler and more maintainable code. Cc: Frank Pavlic <fpavlic@de.ibm.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/s390/net/qeth_main.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index ad7792d..8234846 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c @@ -50,6 +50,7 @@ #include <linux/mii.h> #include <linux/rcupdate.h> #include <linux/ethtool.h> +#include <linux/kthread.h> #include <net/arp.h> #include <net/ip.h> @@ -957,7 +958,6 @@ qeth_recover(void *ptr) int rc = 0; card = (struct qeth_card *) ptr; - daemonize("qeth_recover"); QETH_DBF_TEXT(trace,2,"recover1"); QETH_DBF_HEX(trace, 2, &card, sizeof(void *)); if (!qeth_do_run_thread(card, QETH_RECOVER_THREAD)) @@ -1014,7 +1014,7 @@ qeth_start_kernel_thread(struct work_struct *work) card->write.state != CH_STATE_UP) return; if (qeth_do_start_thread(card, QETH_RECOVER_THREAD)) - kernel_thread(qeth_recover, (void *) card, SIGCHLD); + kthread_run(qeth_recover, card, "qeth_recover"); } -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T06:55:36-00:00

[PATCH] s390/scsi/zfcp_erp: Convert to use the kthread API
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted Modify zfcperp%s to be started with kthread_run not a combination of kernel_thread, daemonize and siginitsetinv making the code slightly simpler and more maintainable. Cc: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/s390/scsi/zfcp_erp.c | 13 ++++++------- 1 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c index 66c0b09..f26536d 100644 --- a/drivers/s390/scsi/zfcp_erp.c +++ b/drivers/s390/scsi/zfcp_erp.c @@ -21,6 +21,7 @@ #define ZFCP_LOG_AREA ZFCP_LOG_AREA_ERP +#include <linux/kthread.h> #include "zfcp_ext.h" static int zfcp_erp_adisc(struct zfcp_port *); @@ -985,12 +986,13 @@ static void zfcp_erp_action_dismiss(struct zfcp_erp_action *erp_action) int zfcp_erp_thread_setup(struct zfcp_adapter *adapter) { - int retval = 0; + struct task_struct *task; atomic_clear_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, &adapter->status); - retval = kernel_thread(zfcp_erp_thread, adapter, SIGCHLD); - if (retval < 0) { + task = kthread_run(zfcp_erp_thread, adapter, + "zfcperp%s", zfcp_get_busid_by_adapter(adapter)); + if (IS_ERR(task)) { ZFCP_LOG_NORMAL("error: creation of erp thread failed for " "adapter %s\n", zfcp_get_busid_by_adapter(adapter)); @@ -1002,7 +1004,7 @@ zfcp_erp_thread_setup(struct zfcp_adapter *adapter) debug_text_event(adapter->erp_dbf, 5, "a_thset_ok"); } - return (retval < 0); + return IS_ERR(task); } /* @@ -1054,9 +1056,6 @@ zfcp_erp_thread(void *data) struct zfcp_erp_action *erp_action; unsigned long flags; - daemonize("zfcperp%s", zfcp_get_busid_by_adapter(adapter)); - /* Block all signals */ - siginitsetinv(&current->blocked, 0); atomic_set_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, &adapter->status); debug_text_event(adapter->erp_dbf, 5, "a_th_run"); wake_up(&adapter->erp_thread_wqh); -- 1.5.0.g53756 _______________________________________________ Containers mailing list Contai…
creator: ebiederm
date: 2007-04-19T06:55:37-00:00

[PATCH] arm ecard: Conver to use the kthread API.
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted This patch modifies the startup of kecardd to use kthread_run not a kernel_thread combination of kernel_thread and daemonize. Making the code slightly simpler and more maintainable. Cc: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- arch/arm/kernel/ecard.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/arm/kernel/ecard.c b/arch/arm/kernel/ecard.c index f1c0fb9..6c15f5f 100644 --- a/arch/arm/kernel/ecard.c +++ b/arch/arm/kernel/ecard.c @@ -40,6 +40,7 @@ #include <linux/device.h> #include <linux/init.h> #include <linux/mutex.h> +#include <linux/kthread.h> #include <asm/dma.h> #include <asm/ecard.h> @@ -263,8 +264,6 @@ static int ecard_init_mm(void) static int ecard_task(void * unused) { - daemonize("kecardd"); - /* * Allocate a mm. We're not a lazy-TLB kernel task since we need * to set page table entries where the user space would be. Note @@ -1058,13 +1057,14 @@ ecard_probe(int slot, card_type_t type) */ static int __init ecard_init(void) { - int slot, irqhw, ret; + struct task_struct *task; + int slot, irqhw; - ret = kernel_thread(ecard_task, NULL, CLONE_KERNEL); - if (ret < 0) { + task = kthread_run(ecard_task, NULL, "kecardd"); + if (IS_ERR(task)) { printk(KERN_ERR "Ecard: unable to create kernel thread: %d\n", - ret); - return ret; + PTR_ERR(task)); + return PTR_ERR(task); } printk("Probing expansion cards\n"); -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T06:55:38-00:00

[PATCH] ia64 sn xpc: Convert to use kthread API.
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted This patch starts the xpc kernel threads using kthread_run not a combination of kernel_thread and daemonize. Resuling in slightly simpler and more maintainable code. Cc: Jes Sorensen <jes@sgi.com> Cc: Tony Luck <tony.luck@intel.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- arch/ia64/sn/kernel/xpc_main.c | 31 +++++++++++++------------------ 1 files changed, 13 insertions(+), 18 deletions(-) diff --git a/arch/ia64/sn/kernel/xpc_main.c b/arch/ia64/sn/kernel/xpc_main.c index e336e16..5b53642 100644 --- a/arch/ia64/sn/kernel/xpc_main.c +++ b/arch/ia64/sn/kernel/xpc_main.c @@ -56,6 +56,7 @@ #include <linux/reboot.h> #include <linux/completion.h> #include <linux/kdebug.h> +#include <linux/kthread.h> #include <asm/sn/intr.h> #include <asm/sn/sn_sal.h> #include <asm/uaccess.h> @@ -253,8 +254,6 @@ xpc_hb_checker(void *ignore) /* this thread was marked active by xpc_hb_init() */ - daemonize(XPC_HB_CHECK_THREAD_NAME); - set_cpus_allowed(current, cpumask_of_cpu(XPC_HB_CHECK_CPU)); xpc_hb_check_timeout = jiffies + (xpc_hb_check_interval * HZ); @@ -324,8 +323,6 @@ xpc_hb_checker(void *ignore) static int xpc_initiate_discovery(void *ignore) { - daemonize(XPC_DISCOVERY_THREAD_NAME); - xpc_discovery(); dev_dbg(xpc_part, "discovery thread is exiting\n"); @@ -494,8 +491,6 @@ xpc_activating(void *__partid) dev_dbg(xpc_part, "bringing partition %d up\n", partid); - daemonize("xpc%02d", partid); - /* * This thread needs to run at a realtime priority to prevent a * significant performance degradation. @@ -559,7 +554,7 @@ xpc_activate_partition(struct xpc_partition *part) { partid_t partid = XPC_PARTID(part); unsigned long irq_flags; - pid_t pid; + struct task_struct *task; spin_lock_irqsave(&part->act_lock, irq_flags); @@ -571,9 +566,10 @@ xpc_activate_partition(struct xpc_partition *part) spin_unlock_irqrestore(&part->act_lock, irq_flags); - pid = kernel_thread(xpc_activating, (void *) ((u64) partid), 0); + tas…
creator: ebiederm
date: 2007-04-19T06:55:39-00:00

[PATCH] powerpc pseries eeh: Convert to kthread API
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted This patch modifies the startup of eehd to use kthread_run not a combination of kernel_thread and daemonize. Making the code slightly simpler and more maintainable. Cc: Paul Mackerras <paulus@samba.org> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- arch/powerpc/platforms/pseries/eeh_event.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/pseries/eeh_event.c b/arch/powerpc/platforms/pseries/eeh_event.c index 221dec8..fe7c2e0 100644 --- a/arch/powerpc/platforms/pseries/eeh_event.c +++ b/arch/powerpc/platforms/pseries/eeh_event.c @@ -23,6 +23,7 @@ #include <linux/mutex.h> #include <linux/pci.h> #include <linux/workqueue.h> +#include <linux/kthread.h> #include <asm/eeh_event.h> #include <asm/ppc-pci.h> @@ -59,7 +60,6 @@ static int eeh_event_handler(void * dummy) struct eeh_event *event; struct pci_dn *pdn; - daemonize ("eehd"); set_current_state(TASK_INTERRUPTIBLE); spin_lock_irqsave(&eeh_eventlist_lock, flags); @@ -105,7 +105,7 @@ static int eeh_event_handler(void * dummy) */ static void eeh_thread_launcher(struct work_struct *dummy) { - if (kernel_thread(eeh_event_handler, NULL, CLONE_KERNEL) < 0) + if (IS_ERR(kthread_run(eeh_event_handler, NULL, "eehd"))) printk(KERN_ERR "Failed to start EEH daemon\n"); } -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T06:55:40-00:00

[PATCH] powerpc pseries rtasd: Convert to kthread API.
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted This patch modifies the startup of rtasd to use kthread_run instaed of a combination of kernel_thread and daemonize. Making the code a little simpler and more maintainble. Cc: Paul Mackerras <paulus@samba.org> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- arch/powerpc/platforms/pseries/rtasd.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/platforms/pseries/rtasd.c b/arch/powerpc/platforms/pseries/rtasd.c index 77d0937..919a374 100644 --- a/arch/powerpc/platforms/pseries/rtasd.c +++ b/arch/powerpc/platforms/pseries/rtasd.c @@ -20,6 +20,7 @@ #include <linux/spinlock.h> #include <linux/cpu.h> #include <linux/delay.h> +#include <linux/kthread.h> #include <asm/uaccess.h> #include <asm/io.h> @@ -429,8 +430,6 @@ static int rtasd(void *unused) int event_scan = rtas_token("event-scan"); int rc; - daemonize("rtasd"); - if (event_scan == RTAS_UNKNOWN_SERVICE || get_eventscan_parms() == -1) goto error; @@ -497,7 +496,7 @@ static int __init rtas_init(void) else printk(KERN_ERR "Failed to create error_log proc entry\n"); - if (kernel_thread(rtasd, NULL, CLONE_FS) < 0) + if (IS_ERR(kthread_run(rtasd, NULL, "rtasd"))) printk(KERN_ERR "Failed to start RTAS daemon\n"); return 0; -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T06:55:41-00:00

[PATCH] macintosh/therm_pm72.c: Convert to kthread API.
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted This patch modifies startup of the kfand to use kthread_run not a combination of kernel_thread and daemonize, making the code a little simpler and more maintaintable. Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/macintosh/therm_pm72.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c index b002a4b..7e9cbb7 100644 --- a/drivers/macintosh/therm_pm72.c +++ b/drivers/macintosh/therm_pm72.c @@ -121,6 +121,7 @@ #include <linux/reboot.h> #include <linux/kmod.h> #include <linux/i2c.h> +#include <linux/kthread.h> #include <asm/prom.h> #include <asm/machdep.h> #include <asm/io.h> @@ -161,7 +162,7 @@ static struct slots_pid_state slots_state; static int state; static int cpu_count; static int cpu_pid_type; -static pid_t ctrl_task; +static int ctrl_task; static struct completion ctrl_complete; static int critical_state; static int rackmac; @@ -1779,8 +1780,6 @@ static int call_critical_overtemp(void) */ static int main_control_loop(void *x) { - daemonize("kfand"); - DBG("main_control_loop started\n"); down(&driver_lock); @@ -1859,7 +1858,6 @@ static int main_control_loop(void *x) machine_power_off(); } - // FIXME: Deal with signals elapsed = jiffies - start; if (elapsed < HZ) schedule_timeout_interruptible(HZ - elapsed); @@ -1954,9 +1952,12 @@ static int create_control_loops(void) */ static void start_control_loops(void) { + struct task_struct *task; init_completion(&ctrl_complete); - ctrl_task = kernel_thread(main_control_loop, NULL, SIGCHLD | CLONE_KERNEL); + task = kthread_run(main_control_loop, NULL, "kfand"); + if (!IS_ERR(task)) + ctrl_task = 1; } /* -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T06:55:42-00:00

[PATCH] macintosh/therm_windtunnel.c: Convert to kthread API.
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted Start the g4fand using kthread_run not a combination of kernel_thread and deamonize. This makes the code a little simpler and more maintainable. Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/macintosh/therm_windtunnel.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c index a1d3a98..5d888e7 100644 --- a/drivers/macintosh/therm_windtunnel.c +++ b/drivers/macintosh/therm_windtunnel.c @@ -36,6 +36,7 @@ #include <linux/i2c.h> #include <linux/slab.h> #include <linux/init.h> +#include <linux/kthread.h> #include <asm/prom.h> #include <asm/machdep.h> @@ -62,7 +63,6 @@ I2C_CLIENT_INSMOD; static struct { volatile int running; struct completion completion; - pid_t poll_task; struct semaphore lock; struct of_device *of_dev; @@ -285,7 +285,6 @@ restore_regs( void ) static int control_loop( void *dummy ) { - daemonize("g4fand"); down( &x.lock ); setup_hardware(); @@ -323,7 +322,7 @@ do_attach( struct i2c_adapter *adapter ) if( x.thermostat && x.fan ) { x.running = 1; init_completion( &x.completion ); - x.poll_task = kernel_thread( control_loop, NULL, SIGCHLD | CLONE_KERNEL ); + kthread_run( control_loop, NULL, "g4fand"); } } return ret; -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T06:55:43-00:00

[PATCH] macintosh/adb: Convert to the kthread API
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted This patch modifies the startup of kadbprobe to use kthread_run instead of scheduling a work event which later calls kernel_thread and in the thread calls daemonize and blocks signals. kthread_run is simpler and more maintainable. The variable pid_t adb_probe_task_pid is replaced by a struct task_struct variable named adb_probe_task. Which works equally well with for testing if the current process is the adb_probe thread, does not get confused in the presence of a pid namespace and is easier to compare against current as it is the same type. The result is code that is slightly simpler and easier to maintain. Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/macintosh/adb.c | 32 +++++++------------------------- 1 files changed, 7 insertions(+), 25 deletions(-) diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c index adfea3c..09c5261 100644 --- a/drivers/macintosh/adb.c +++ b/drivers/macintosh/adb.c @@ -35,6 +35,7 @@ #include <linux/spinlock.h> #include <linux/completion.h> #include <linux/device.h> +#include <linux/kthread.h> #include <asm/uaccess.h> #include <asm/semaphore.h> @@ -82,7 +83,7 @@ struct adb_driver *adb_controller; BLOCKING_NOTIFIER_HEAD(adb_client_list); static int adb_got_sleep; static int adb_inited; -static pid_t adb_probe_task_pid; +static struct task_struct *adb_probe_task; static DECLARE_MUTEX(adb_probe_mutex); static struct completion adb_probe_task_comp; static int sleepy_trackpad; @@ -137,8 +138,7 @@ static void printADBreply(struct adb_request *req) static __inline__ void adb_wait_ms(unsigned int ms) { - if (current->pid && adb_probe_task_pid && - adb_probe_task_pid == current->pid) + if (adb_probe_task == current) msleep(ms); else mdelay(ms); @@ -245,35 +245,19 @@ static int adb_scan_bus(void) * This kernel task handles ADB probing. It dies once probing is * comp…
creator: ebiederm
date: 2007-04-19T06:55:44-00:00

[PATCH] macintosh/mediabay: Convert to kthread API.
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted This patch modifies the startup of the media_bay_task to use kthread_run and not a combination of kernel_thread, deamonize and sigfillset. In addition since we now always want to ignore signals the MB_IGNORE_SIGNALS define is removed along with the test for signal_pending. The result is slightly simpler code that is more maintainable. Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/macintosh/mediabay.c | 11 ++--------- 1 files changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c index c803d2b..90c853e 100644 --- a/drivers/macintosh/mediabay.c +++ b/drivers/macintosh/mediabay.c @@ -20,6 +20,7 @@ #include <linux/stddef.h> #include <linux/init.h> #include <linux/ide.h> +#include <linux/kthread.h> #include <asm/prom.h> #include <asm/pgtable.h> #include <asm/io.h> @@ -35,7 +36,6 @@ #define MB_DEBUG -#define MB_IGNORE_SIGNALS #ifdef MB_DEBUG #define MBDBG(fmt, arg...) printk(KERN_INFO fmt , ## arg) @@ -622,11 +622,6 @@ static int media_bay_task(void *x) { int i; - strcpy(current->comm, "media-bay"); -#ifdef MB_IGNORE_SIGNALS - sigfillset(&current->blocked); -#endif - for (;;) { for (i = 0; i < media_bay_count; ++i) { down(&media_bays[i].lock); @@ -636,8 +631,6 @@ static int media_bay_task(void *x) } msleep_interruptible(MB_POLL_DELAY); - if (signal_pending(current)) - return 0; } } @@ -699,7 +692,7 @@ static int __devinit media_bay_attach(struct macio_dev *mdev, const struct of_de /* Startup kernel thread */ if (i == 0) - kernel_thread(media_bay_task, NULL, CLONE_KERNEL); + kthread_run(media_bay_task, NULL, "media-bay"); return 0; -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T06:55:45-00:00

[PATCH] bluetooth bnep: Convert to kthread API.
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted This patch starts kbenpd using kthread_run replacing a combination of kernel_thread and daemonize. Making the code a little simpler and more maintainable. Cc: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- net/bluetooth/bnep/core.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c index a9f1e88..de3caed 100644 --- a/net/bluetooth/bnep/core.c +++ b/net/bluetooth/bnep/core.c @@ -32,6 +32,7 @@ #include <linux/module.h> #include <linux/kernel.h> +#include <linux/kthread.h> #include <linux/sched.h> #include <linux/signal.h> #include <linux/init.h> @@ -473,7 +474,6 @@ static int bnep_session(void *arg) BT_DBG(""); - daemonize("kbnepd %s", dev->name); set_user_nice(current, -15); init_waitqueue_entry(&wait, current); @@ -539,6 +539,7 @@ static struct device *bnep_get_device(struct bnep_session *session) int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock) { + struct task_struct *task; struct net_device *dev; struct bnep_session *s, *ss; u8 dst[ETH_ALEN], src[ETH_ALEN]; @@ -598,9 +599,10 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock) __bnep_link_session(s); - err = kernel_thread(bnep_session, s, CLONE_KERNEL); - if (err < 0) { + task = kthread_run(bnep_session, s, "kbnepd %s", dev->name); + if (IS_ERR(task)) { /* Session thread start failed, gotta cleanup. */ + err = PTR_ERR(task); unregister_netdev(dev); __bnep_unlink_session(s); goto failed; -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T06:55:46-00:00

[PATCH] bluetooth cmtp: Convert to use kthread API.
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted This patch modifies the kcmptd_ctr_%d daemon using kthread_run instead of a combination of kernel_thread and daemonize making the code a little simpler and more maintainable. Cc: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- net/bluetooth/cmtp/core.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/net/bluetooth/cmtp/core.c b/net/bluetooth/cmtp/core.c index e1b9db9..993303f 100644 --- a/net/bluetooth/cmtp/core.c +++ b/net/bluetooth/cmtp/core.c @@ -35,6 +35,7 @@ #include <linux/file.h> #include <linux/init.h> #include <linux/freezer.h> +#include <linux/kthread.h> #include <net/sock.h> #include <linux/isdn/capilli.h> @@ -286,7 +287,6 @@ static int cmtp_session(void *arg) BT_DBG("session %p", session); - daemonize("kcmtpd_ctr_%d", session->num); set_user_nice(current, -15); init_waitqueue_entry(&wait, current); @@ -329,6 +329,7 @@ static int cmtp_session(void *arg) int cmtp_add_connection(struct cmtp_connadd_req *req, struct socket *sock) { struct cmtp_session *session, *s; + struct task_struct *task; bdaddr_t src, dst; int i, err; @@ -375,8 +376,9 @@ int cmtp_add_connection(struct cmtp_connadd_req *req, struct socket *sock) __cmtp_link_session(session); - err = kernel_thread(cmtp_session, session, CLONE_KERNEL); - if (err < 0) + task = kthread_run(cmtp_session, session, "kcmtpd_ctr_%d", session->num); + err = PTR_ERR(task); + if (IS_ERR(task)) goto unlink; if (!(session->flags & (1 << CMTP_LOOPBACK))) { -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T06:55:47-00:00

[PATCH] bluetooth hidp: Convert to kthread API.
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted This patch starts up khidp using kthread_run instead of kernel_thread and daemonize, resulting is slightly simpler and more maintainable code. Cc: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- net/bluetooth/hidp/core.c | 29 ++++++++++++++++------------- 1 files changed, 16 insertions(+), 13 deletions(-) diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index df2c471..1c9b202 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c @@ -36,6 +36,7 @@ #include <linux/init.h> #include <linux/wait.h> #include <linux/freezer.h> +#include <linux/kthread.h> #include <net/sock.h> #include <linux/input.h> @@ -531,22 +532,11 @@ static int hidp_session(void *arg) struct sock *ctrl_sk = session->ctrl_sock->sk; struct sock *intr_sk = session->intr_sock->sk; struct sk_buff *skb; - int vendor = 0x0000, product = 0x0000; wait_queue_t ctrl_wait, intr_wait; BT_DBG("session %p", session); - if (session->input) { - vendor = session->input->id.vendor; - product = session->input->id.product; - } - - if (session->hid) { - vendor = session->hid->vendor; - product = session->hid->product; - } - daemonize("khidpd_%04x%04x", vendor, product); set_user_nice(current, -15); init_waitqueue_entry(&ctrl_wait, current); @@ -747,7 +737,9 @@ static inline void hidp_setup_hid(struct hidp_session *session, struct hidp_conn int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock, struct socket *intr_sock) { + int vendor = 0x0000, product = 0x0000; struct hidp_session *session, *s; + struct task_struct *task; int err; BT_DBG(""); @@ -834,8 +826,19 @@ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock, hidp_set_timer(session); - err = kernel_thread(hidp_session, session, CLONE_KERNEL); - if (err < 0) + if (session->input) { + vendor = session->input->id.vendor; + product = session->input->id.product; + } + + if (sess…
creator: ebiederm
date: 2007-04-19T06:55:48-00:00

[PATCH] bluetooth rfcomm: Convert to kthread API.
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted This patch starts krfcommd using kthread_run instead of a combination of kernel_thread and daemonize making the code slightly simpler and more maintainable. Cc: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- net/bluetooth/rfcomm/core.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index 34f993a..baaad49 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c @@ -38,6 +38,7 @@ #include <linux/net.h> #include <linux/mutex.h> #include <linux/freezer.h> +#include <linux/kthread.h> #include <net/sock.h> #include <asm/uaccess.h> @@ -1938,7 +1939,6 @@ static int rfcomm_run(void *unused) atomic_inc(&running); - daemonize("krfcommd"); set_user_nice(current, -10); BT_DBG(""); @@ -2058,7 +2058,7 @@ static int __init rfcomm_init(void) hci_register_cb(&rfcomm_cb); - kernel_thread(rfcomm_run, NULL, CLONE_KERNEL); + kthread_run(rfcomm_run, NULL, "krfcommd"); if (class_create_file(bt_class, &class_attr_rfcomm_dlc) < 0) BT_ERR("Failed to create RFCOMM info file"); -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T06:55:49-00:00

[PATCH] fs/afs: Convert to kthread API.
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted This patch modifies the startup of kafscmd, kafsasyncd, and kafstimod to use kthread_run instead of a combination of kernel_thread and daemonize making the code slightly simpler and more maintainable. In addition since by default all signals are ignored when delivered to a kernel thread the code to flush signals has been removed. Cc: David Howells <dhowells@redhat.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- fs/afs/cmservice.c | 10 +++++----- fs/afs/internal.h | 11 ----------- fs/afs/kafsasyncd.c | 17 ++++++----------- fs/afs/kafstimod.c | 16 ++++++---------- 4 files changed, 17 insertions(+), 37 deletions(-) diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c index 3d097fd..f7e2355 100644 --- a/fs/afs/cmservice.c +++ b/fs/afs/cmservice.c @@ -13,6 +13,7 @@ #include <linux/init.h> #include <linux/sched.h> #include <linux/completion.h> +#include <linux/kthread.h> #include "server.h" #include "cell.h" #include "transport.h" @@ -120,8 +121,6 @@ static int kafscmd(void *arg) printk(KERN_INFO "kAFS: Started kafscmd %d\n", current->pid); - daemonize("kafscmd"); - complete(&kafscmd_alive); /* loop around looking for things to attend to */ @@ -133,7 +132,6 @@ static int kafscmd(void *arg) for (;;) { set_current_state(TASK_INTERRUPTIBLE); if (!list_empty(&kafscmd_attention_list) || - signal_pending(current) || kafscmd_die) break; @@ -297,8 +295,10 @@ int afscm_start(void) down_write(&afscm_sem); if (!afscm_usage) { - ret = kernel_thread(kafscmd, NULL, 0); - if (ret < 0) + struct task_struct *task; + task = kthread_run(kafscmd, NULL, "kafscmd"); + ret = PTR_ERR(task); + if (IS_ERR(task)) goto out; wait_for_completion(&kafscmd_alive); diff --git a/fs/afs/internal.h b/fs/afs/internal.h index 5151d5d..2d667b7 100644 --- a/fs/afs/internal.h +++ b/fs/afs/internal.h @@ -40,17 +40,6 @@ #define _net(FMT, a...) do { } while(0) #endif -static inline void afs_discard_my_signals(void) -{ - while (signal_pendi…
creator: ebiederm
date: 2007-04-19T06:55:50-00:00

[PATCH] net/rxrpc: Convert to kthread API.
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted This patch modifies the startup of krxtimod, krxiod, and krxsecd to use kthread_run instead of a combination of kernel_thread and daemonize making the code slightly simpler and more maintainable. In addition since by default all signals are ignored when delivered to a kernel thread the code to flush signals has been removed. Cc: David Howells <dhowells@redhat.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- net/rxrpc/internal.h | 11 ----------- net/rxrpc/krxiod.c | 16 ++++++++-------- net/rxrpc/krxsecd.c | 16 ++++++++-------- net/rxrpc/krxtimod.c | 15 ++++++--------- 4 files changed, 22 insertions(+), 36 deletions(-) diff --git a/net/rxrpc/internal.h b/net/rxrpc/internal.h index cc0c579..1dd69aa 100644 --- a/net/rxrpc/internal.h +++ b/net/rxrpc/internal.h @@ -49,17 +49,6 @@ __RXACCT_DECL(extern atomic_t rxrpc_message_count); #define _net(FMT, a...) do { if (rxrpc_knet) knet (FMT , ##a); } while(0) #endif -static inline void rxrpc_discard_my_signals(void) -{ - while (signal_pending(current)) { - siginfo_t sinfo; - - spin_lock_irq(&current->sighand->siglock); - dequeue_signal(current, &current->blocked, &sinfo); - spin_unlock_irq(&current->sighand->siglock); - } -} - /* * call.c */ diff --git a/net/rxrpc/krxiod.c b/net/rxrpc/krxiod.c index bbbcd6c..c590ccd 100644 --- a/net/rxrpc/krxiod.c +++ b/net/rxrpc/krxiod.c @@ -14,6 +14,7 @@ #include <linux/spinlock.h> #include <linux/init.h> #include <linux/freezer.h> +#include <linux/kthread.h> #include <rxrpc/krxiod.h> #include <rxrpc/transport.h> #include <rxrpc/peer.h> @@ -43,8 +44,6 @@ static int rxrpc_krxiod(void *arg) printk("Started krxiod %d\n",current->pid); - daemonize("krxiod"); - /* loop around waiting for work to do */ do { /* wait for work or to be told to exit */ @@ -57,8 +56,7 @@ static int rxrpc_krxiod(void *arg) for (;;) { set_current_state(TASK_INTERRUPTIBLE); if (atomic_read(&rxrpc_krxiod_qcount) || - rxrpc_krxiod_die || - signal_pen…
creator: ebiederm
date: 2007-04-19T06:55:51-00:00

[PATCH] ipv4/ipvs: Convert to kthread API
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted Modify startup of ipvs sync threads to use kthread_run instead of a weird combination of calling kernel_thread to start a fork_sync_thread whose hole purpose in life was to call kernel_thread again starting the actually sync thread which called daemonize. To use kthread_run I had to move the name calcuation from sync_thread into start_sync_thread resulting in a small amount of code motion. The result is simpler and more maintainable piece of code. Cc: Wensong Zhang <wensong@linux-vs.org> Cc: Julian Anastasov <ja@ssi.bg> Cc: Simon Horman <horms@verge.net.au> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- net/ipv4/ipvs/ip_vs_sync.c | 49 ++++++++++--------------------------------- 1 files changed, 12 insertions(+), 37 deletions(-) diff --git a/net/ipv4/ipvs/ip_vs_sync.c b/net/ipv4/ipvs/ip_vs_sync.c index 7ea2d98..c4be9dc 100644 --- a/net/ipv4/ipvs/ip_vs_sync.c +++ b/net/ipv4/ipvs/ip_vs_sync.c @@ -29,6 +29,7 @@ #include <linux/in.h> #include <linux/igmp.h> /* for ip_mc_join_group */ #include <linux/udp.h> +#include <linux/kthread.h> #include <net/ip.h> #include <net/sock.h> @@ -750,34 +751,23 @@ static int sync_thread(void *startup) DECLARE_WAITQUEUE(wait, current); mm_segment_t oldmm; int state; - const char *name; /* increase the module use count */ ip_vs_use_count_inc(); - if (ip_vs_sync_state & IP_VS_STATE_MASTER && !sync_master_pid) { + if (ip_vs_sync_state & IP_VS_STATE_MASTER && !sync_master_pid) state = IP_VS_STATE_MASTER; - name = "ipvs_syncmaster"; - } else if (ip_vs_sync_state & IP_VS_STATE_BACKUP && !sync_backup_pid) { + else if (ip_vs_sync_state & IP_VS_STATE_BACKUP && !sync_backup_pid) state = IP_VS_STATE_BACKUP; - name = "ipvs_syncbackup"; - } else { + else { IP_VS_BUG(); ip_vs_use_count_dec(); return -EINVAL; } - daemonize(name); - oldmm = get_fs(); set_fs(KERNEL_DS); - /* Block all signals */ - spin_lock_irq(&current->sighand->siglock); - siginitsetinv(&current->blocked, 0); - reca…
creator: ebiederm
date: 2007-04-19T06:55:52-00:00

[PATCH] saa7134-tvaudio: Convert to kthread API.
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted It is my goal to replace all kernel code that handles signals from user space, calls kernel_thread or calls daemonize. All of which the kthread_api makes unncessary. Handling signals from user space is a maintenance problem becuase using a kernel thread is an implementation detail and if user space cares it does not allow us to change the implementation. Calling daemonize is a problem because it has to undo a continually changing set of state generated by user space, requiring the implemetation to change continually. kernel_thread is a problem because it returns a pid_t value. Numeric pids are inherently racy and in the presence of a pid namespace they are no longer global making them useless for general use in the kernel. So this patch renames the pid member of struct saa7134_thread started and changes it's type from pid_t to int. All it has ever been used for is to detect if the kernel thread is has been started so this works. allow_signal(SIGTERM) and the calls to signal_pending have been removed they are needed for the driver to operation. The startup of tvaudio_thread and tvaudio_thread_dep have been modified to use kthread_run instead of a combination of kernel_thread and daemonize. The result is code that is slightly simpler and more maintainable. Cc: Hartmut Hackmann <hartmut.hackmann@t-online.de> Cc: Mauro Carvalho Chehab <mchehab@infradead.org> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/media/video/saa7134/saa7134-tvaudio.c | 27 ++++++++++++------------- drivers/media/video/saa7134/saa7134.h | 2 +- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c index 7b56041..b636cb1 100644 --- a/drivers/media/video/saa7134/saa7134-tvaudio.c +++ b/drivers/media/video/saa7134/saa7134-tvaudio.c @@ -27,6 +27,7 @@ #include <linux/kernel.h> #include <linux/slab.h> #include <linux/delay…
creator: ebiederm
date: 2007-04-19T06:55:53-00:00

[PATCH] nfs lockd reclaimer: Convert to kthread API
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted Start the reclaimer thread using kthread_run instead of a combination of kernel_thread and daemonize. The small amount of signal handling code is also removed as it makes no sense and is a maintenance problem to handle signals in kernel threads. Cc: Neil Brown <neilb@suse.de> Cc: Trond Myklebust <trond.myklebust@fys.uio.no> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- fs/lockd/clntlock.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-) diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c index f4d45d4..83591f6 100644 --- a/fs/lockd/clntlock.c +++ b/fs/lockd/clntlock.c @@ -9,6 +9,7 @@ #include <linux/module.h> #include <linux/types.h> #include <linux/time.h> +#include <linux/kthread.h> #include <linux/nfs_fs.h> #include <linux/sunrpc/clnt.h> #include <linux/sunrpc/svc.h> @@ -153,7 +154,7 @@ nlmclnt_recovery(struct nlm_host *host) if (!host->h_reclaiming++) { nlm_get_host(host); __module_get(THIS_MODULE); - if (kernel_thread(reclaimer, host, CLONE_KERNEL) < 0) + if (IS_ERR(kthread_run(reclaimer, host, "%s-reclaim", host->h_name))) module_put(THIS_MODULE); } } @@ -166,9 +167,6 @@ reclaimer(void *ptr) struct file_lock *fl, *next; u32 nsmstate; - daemonize("%s-reclaim", host->h_name); - allow_signal(SIGKILL); - down_write(&host->h_rwsem); /* This one ensures that our parent doesn't terminate while the @@ -193,8 +191,6 @@ restart: list_del_init(&fl->fl_u.nfs_fl.list); /* Why are we leaking memory here? --okir */ - if (signalled()) - continue; if (nlmclnt_reclaim(host, fl) != 0) continue; list_add_tail(&fl->fl_u.nfs_fl.list, &host->h_granted); -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T06:55:54-00:00

[PATCH] nfsv4 delegation: Convert to kthread API
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted To start the nfsv4-delegreturn thread this patch uses kthread_run instead of a combination of kernel_thread and daemonize. In addition allow_signal(SIGKILL) is removed from the expire delegations thread. Cc: Neil Brown <neilb@suse.de> Cc: Trond Myklebust <trond.myklebust@fys.uio.no> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- fs/nfs/delegation.c | 11 ++++------- 1 files changed, 4 insertions(+), 7 deletions(-) diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index 841c99a..7b9b88c 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c @@ -232,7 +232,6 @@ int nfs_do_expire_all_delegations(void *ptr) struct nfs_delegation *delegation; struct inode *inode; - allow_signal(SIGKILL); restart: spin_lock(&clp->cl_lock); if (test_bit(NFS4CLNT_STATE_RECOVER, &clp->cl_state) != 0) @@ -310,8 +309,6 @@ static int recall_thread(void *data) struct nfs_inode *nfsi = NFS_I(inode); struct nfs_delegation *delegation; - daemonize("nfsv4-delegreturn"); - nfs_msync_inode(inode); down_read(&clp->cl_sem); down_write(&nfsi->rwsem); @@ -350,18 +347,18 @@ int nfs_async_inode_return_delegation(struct inode *inode, const nfs4_stateid *s .inode = inode, .stateid = stateid, }; - int status; + struct task_struct *task; init_completion(&data.started); __module_get(THIS_MODULE); - status = kernel_thread(recall_thread, &data, CLONE_KERNEL); - if (status < 0) + task = kthread_run(recall_thread, &data, "nfsv4-delegreturn"); + if (IS_ERR(task)) goto out_module_put; wait_for_completion(&data.started); return data.result; out_module_put: module_put(THIS_MODULE); - return status; + return PTR_ERR(task); } /* -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T06:55:55-00:00

[PATCH] nfsd/nfs4state: Remove unnecessary daemonize call.
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted Cc: Neil Brown <neilb@suse.de> Cc: Trond Myklebust <trond.myklebust@fys.uio.no> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- fs/nfsd/nfs4state.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 678f3be..3cc8ce4 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -1326,8 +1326,6 @@ do_recall(void *__dp) { struct nfs4_delegation *dp = __dp; - daemonize("nfsv4-recall"); - nfsd4_cb_recall(dp); return 0; } -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T06:55:56-00:00

[PATCH] nfs4state reclaimer: Remove unnecessary allow_signal
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted Cc: Neil Brown <neilb@suse.de> Cc: Trond Myklebust <trond.myklebust@fys.uio.no> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- fs/nfs/nfs4state.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 5fffbdf..d16393f 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c @@ -775,8 +775,6 @@ static int reclaimer(void *ptr) struct rpc_cred *cred; int status = 0; - allow_signal(SIGKILL); - /* Ensure exclusive access to NFSv4 state */ lock_kernel(); down_write(&clp->cl_sem); -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T06:55:57-00:00

[PATCH] smbfs: Remove unnecessary allow_signal
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- fs/smbfs/smbiod.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/fs/smbfs/smbiod.c b/fs/smbfs/smbiod.c index 3e61b44..67176af 100644 --- a/fs/smbfs/smbiod.c +++ b/fs/smbfs/smbiod.c @@ -298,8 +298,6 @@ out: */ static int smbiod(void *unused) { - allow_signal(SIGKILL); - VERBOSE("SMB Kernel thread starting (%d) ...\n", current->pid); for (;;) { -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T06:55:58-00:00

[PATCH] dvb_en_50221: Convert to kthread API
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted This patch is a minimal transformation to use the kthread API doing it's best to preserve the existing logic. Instead of starting kdvb-ca by calling kernel_thread, daemonize and sigfillset we kthread_run is used. Instead of tracking the pid of the running thread we instead simply keep a flag to indicate that the current thread is running, as that is all the pid is really used for. And finally the kill_proc sending signal 0 to the kernel thread to ensure it is alive before we wait for it to shutdown is removed. The kthread API does not provide the pid so we don't have that information readily available and the test is just silly. If there is no shutdown race the test is a useless confirmation of that the thread is running. If there is a race the test doesn't fix it and we should fix the race properly. Cc: Andrew de Quincey <adq_dvb@lidskialf.net> Cc: Mauro Carvalho Chehab <mchehab@infradead.org> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/media/dvb/dvb-core/dvb_ca_en50221.c | 46 ++++++++++---------------- 1 files changed, 18 insertions(+), 28 deletions(-) diff --git a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c index 2a03bf5..b28bc15 100644 --- a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c +++ b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c @@ -37,6 +37,7 @@ #include <linux/delay.h> #include <linux/spinlock.h> #include <linux/sched.h> +#include <linux/kthread.h> #include "dvb_ca_en50221.h" #include "dvb_ringbuffer.h" @@ -139,8 +140,8 @@ struct dvb_ca_private { /* wait queues for read() and write() operations */ wait_queue_head_t wait_queue; - /* PID of the monitoring thread */ - pid_t thread_pid; + /* Flag indicating the monitoring thread is running */ + int thread_running; /* Wait queue used when shutting thread down */ wait_queue_head_t thread_queue; @@ -982,7 +983,6 @@ static void dvb_ca_en50221_thread_update_delay(struct dvb_ca_private *…
creator: ebiederm
date: 2007-04-19T06:55:59-00:00

[PATCH] md: Remove broken SIGKILL support
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted Currently md_thread calls allow_signal so it can receive a SIGKILL but then does nothing with it except flush the sigkill so that it not can use an interruptible sleep. This whole dance is silly so remove the unnecessary and broken signal handling logic. Cc: Neil Brown <neilb@suse.de> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/md/md.c | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index 1299c23..dfd0cb9 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -4542,17 +4542,11 @@ static int md_thread(void * arg) */ current->flags |= PF_NOFREEZE; - allow_signal(SIGKILL); while (!kthread_should_stop()) { /* We need to wait INTERRUPTIBLE so that * we don't add to the load-average. - * That means we need to be sure no signals are - * pending */ - if (signal_pending(current)) - flush_signals(current); - wait_event_interruptible_timeout (thread->wqueue, test_bit(THREAD_WAKEUP, &thread->flags) -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T06:56:00-00:00

[PATCH] synchro_test: Convert to the kthread API.
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> - unquoted Cc: David Howells <dhowells@redhat.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- kernel/synchro-test.c | 16 ++++++---------- 1 files changed, 6 insertions(+), 10 deletions(-) diff --git a/kernel/synchro-test.c b/kernel/synchro-test.c index a4747a6..b1d7fd6 100644 --- a/kernel/synchro-test.c +++ b/kernel/synchro-test.c @@ -30,6 +30,7 @@ #include <linux/timer.h> #include <linux/completion.h> #include <linux/mutex.h> +#include <linux/kthread.h> #define MAX_THREADS 64 @@ -224,7 +225,6 @@ static int mutexer(void *arg) { unsigned int N = (unsigned long) arg; - daemonize("Mutex%u", N); set_user_nice(current, 19); while (atomic_read(&do_stuff)) { @@ -246,7 +246,6 @@ static int semaphorer(void *arg) { unsigned int N = (unsigned long) arg; - daemonize("Sem%u", N); set_user_nice(current, 19); while (atomic_read(&do_stuff)) { @@ -268,7 +267,6 @@ static int reader(void *arg) { unsigned int N = (unsigned long) arg; - daemonize("Read%u", N); set_user_nice(current, 19); while (atomic_read(&do_stuff)) { @@ -292,7 +290,6 @@ static int writer(void *arg) { unsigned int N = (unsigned long) arg; - daemonize("Write%u", N); set_user_nice(current, 19); while (atomic_read(&do_stuff)) { @@ -316,7 +313,6 @@ static int downgrader(void *arg) { unsigned int N = (unsigned long) arg; - daemonize("Down%u", N); set_user_nice(current, 19); while (atomic_read(&do_stuff)) { @@ -433,27 +429,27 @@ static int __init do_tests(void) for (loop = 0; loop < MAX_THREADS; loop++) { if (loop < nummx) { init_completion(&mx_comp[loop]); - kernel_thread(mutexer, (void *) loop, 0); + kthread_run(mutexer, (void *) loop, "Mutex%u", loop); } if (loop < numsm) { init_completion(&sm_comp[loop]); - kernel_thread(semaphorer, (void *) loop, 0); + kthread_run(semaphorer, (void *) loop, "Sem%u", loop); } if (loop < numrd) { init_completion(&rd_comp[loop]); - kernel_thread(reader, (void *) loop, 0); + kthread_run(reader, (void *) loop, "Read%u", loop)…
creator: ebiederm
date: 2007-04-19T06:56:01-00:00

[PATCH] synchro_test: Convert to the kthread API.
type: item
description: _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T06:56:02-00:00

[PATCH] i386 balance_irq: Convert to the kthread api.
type: item
description: This patch just trivial converts from calling kernel_thread and daemonize to just calling kthread_run. Cc: Andi Kleen <ak@suse.de> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- arch/i386/kernel/io_apic.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c index 24ac67c..84b412a 100644 --- a/arch/i386/kernel/io_apic.c +++ b/arch/i386/kernel/io_apic.c @@ -34,6 +34,7 @@ #include <linux/msi.h> #include <linux/htirq.h> #include <linux/freezer.h> +#include <linux/kthread.h> #include <asm/io.h> #include <asm/smp.h> @@ -660,8 +661,6 @@ static int balanced_irq(void *unused) unsigned long prev_balance_time = jiffies; long time_remaining = balanced_irq_interval; - daemonize("kirqd"); - /* push everything to CPU 0 to give us a starting point. */ for (i = 0 ; i < NR_IRQS ; i++) { irq_desc[i].pending_mask = cpumask_of_cpu(0); @@ -721,7 +720,7 @@ static int __init balanced_irq_init(void) } printk(KERN_INFO "Starting balanced_irq\n"); - if (kernel_thread(balanced_irq, NULL, CLONE_KERNEL) >= 0) + if (!IS_ERR(kthread_run(balanced_irq, NULL, "kirqd"))) return 0; else printk(KERN_ERR "balanced_irq_init: failed to spawn balanced_irq"); -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T07:58:31-00:00

[PATCH] i386 voyager: Convert the monitor thread to use the kthread API
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> This patch just trivially replaces kernel_thread and daemonize with a single call to kthread_run. CC: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- arch/i386/mach-voyager/voyager_thread.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/i386/mach-voyager/voyager_thread.c b/arch/i386/mach-voyager/voyager_thread.c index ebfd913..ee23d9b 100644 --- a/arch/i386/mach-voyager/voyager_thread.c +++ b/arch/i386/mach-voyager/voyager_thread.c @@ -23,6 +23,7 @@ #include <linux/kmod.h> #include <linux/completion.h> #include <linux/sched.h> +#include <linux/kthread.h> #include <asm/desc.h> #include <asm/voyager.h> #include <asm/vic.h> @@ -43,7 +44,7 @@ static __u8 set_timeout = 0; static int __init voyager_thread_start(void) { - if(kernel_thread(thread, NULL, CLONE_KERNEL) < 0) { + if (IS_ERR(kthread_run(thread, NULL, "%s", THREAD_NAME))) { /* This is serious, but not fatal */ printk(KERN_ERR "Voyager: Failed to create system monitor thread!!!\n"); return 1; @@ -122,8 +123,6 @@ thread(void *unused) kvoyagerd_running = 1; - daemonize(THREAD_NAME); - set_timeout = 0; init_timer(&wakeup_timer); -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T07:58:32-00:00

[PATCH] mtd_blkdevs: Convert to use the kthread API
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> thread_run is used intead of kernel_thread, daemonize, and mucking around blocking signals directly. CC: David Woodhouse <dwmw2@infradead.org> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/mtd/mtd_blkdevs.c | 19 +++++-------------- 1 files changed, 5 insertions(+), 14 deletions(-) diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c index db7397c..ed71d5e 100644 --- a/drivers/mtd/mtd_blkdevs.c +++ b/drivers/mtd/mtd_blkdevs.c @@ -21,6 +21,7 @@ #include <linux/init.h> #include <linux/mutex.h> #include <linux/freezer.h> +#include <linux/kthread.h> #include <asm/uaccess.h> static LIST_HEAD(blktrans_majors); @@ -84,17 +85,6 @@ static int mtd_blktrans_thread(void *arg) /* we might get involved when memory gets low, so use PF_MEMALLOC */ current->flags |= PF_MEMALLOC | PF_NOFREEZE; - daemonize("%sd", tr->name); - - /* daemonize() doesn't do this for us since some kernel threads - actually want to deal with signals. We can't just call - exit_sighand() since that'll cause an oops when we finally - do exit. */ - spin_lock_irq(&current->sighand->siglock); - sigfillset(&current->blocked); - recalc_sigpending(); - spin_unlock_irq(&current->sighand->siglock); - spin_lock_irq(rq->queue_lock); while (!tr->blkcore_priv->exiting) { @@ -368,6 +358,7 @@ static struct mtd_notifier blktrans_notifier = { int register_mtd_blktrans(struct mtd_blktrans_ops *tr) { + struct task_struct *task; int ret, i; /* Register the notifier if/when the first device type is @@ -406,13 +397,13 @@ int register_mtd_blktrans(struct mtd_blktrans_ops *tr) blk_queue_hardsect_size(tr->blkcore_priv->rq, tr->blksize); tr->blkshift = ffs(tr->blksize) - 1; - ret = kernel_thread(mtd_blktrans_thread, tr, CLONE_KERNEL); - if (ret < 0) { + task = kthread_run(mtd_blktrans_thread, tr, "%sd", tr->name); + if (IS_ERR(task)) { blk_cleanup_queue(tr->blkcore_priv->rq); unregister_blkdev(tr->major, tr->name); kfree(tr->blkcore_priv); mutex_unlock…
creator: ebiederm
date: 2007-04-19T07:58:33-00:00

[PATCH] cpci_hotplug: Convert to use the kthread API
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> kthread_run replaces the kernel_thread and daemonize calls during thread startup. Calls to signal_pending were also removed as it is currently impossible for the cpci_hotplug thread to receive signals. CC: Scott Murray <scottm@somanetworks.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/pci/hotplug/cpci_hotplug_core.c | 22 +++++++--------------- 1 files changed, 7 insertions(+), 15 deletions(-) diff --git a/drivers/pci/hotplug/cpci_hotplug_core.c b/drivers/pci/hotplug/cpci_hotplug_core.c index 6845515..c620c7e 100644 --- a/drivers/pci/hotplug/cpci_hotplug_core.c +++ b/drivers/pci/hotplug/cpci_hotplug_core.c @@ -33,6 +33,7 @@ #include <linux/init.h> #include <linux/interrupt.h> #include <linux/smp_lock.h> +#include <linux/kthread.h> #include <asm/atomic.h> #include <linux/delay.h> #include "cpci_hotplug.h" @@ -521,17 +522,13 @@ event_thread(void *data) { int rc; - lock_kernel(); - daemonize("cpci_hp_eventd"); - unlock_kernel(); - dbg("%s - event thread started", __FUNCTION__); while (1) { dbg("event thread sleeping"); down_interruptible(&event_semaphore); dbg("event thread woken, thread_finished = %d", thread_finished); - if (thread_finished || signal_pending(current)) + if (thread_finished) break; do { rc = check_slots(); @@ -562,12 +559,8 @@ poll_thread(void *data) { int rc; - lock_kernel(); - daemonize("cpci_hp_polld"); - unlock_kernel(); - while (1) { - if (thread_finished || signal_pending(current)) + if (thread_finished) break; if (controller->ops->query_enum()) { do { @@ -592,7 +585,7 @@ poll_thread(void *data) static int cpci_start_thread(void) { - int pid; + struct task_struct *task; /* initialize our semaphores */ init_MUTEX_LOCKED(&event_semaphore); @@ -600,14 +593,13 @@ cpci_start_thread(void) thread_finished = 0; if (controller->irq) - pid = kernel_thread(event_thread, NULL, 0); + task = kthread_run(event_thread, NULL, "cpci_hp_eventd"); else - pid = kernel_thread(poll_thread, NULL…
creator: ebiederm
date: 2007-04-19T07:58:34-00:00

[PATCH] ibmphp: Convert to use the kthreads API
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> kthread_run replaces kernel_thread and dameonize. allow_signal is unnecessary and has been removed. tid_poll was unused and has been removed. Cc: Jyoti Shah <jshah@us.ibm.com> Cc: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/pci/hotplug/ibmphp_hpc.c | 14 +++++--------- 1 files changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/pci/hotplug/ibmphp_hpc.c b/drivers/pci/hotplug/ibmphp_hpc.c index 46abaa8..27e12f1 100644 --- a/drivers/pci/hotplug/ibmphp_hpc.c +++ b/drivers/pci/hotplug/ibmphp_hpc.c @@ -34,6 +34,7 @@ #include <linux/pci.h> #include <linux/init.h> #include <linux/mutex.h> +#include <linux/kthread.h> #include "ibmphp.h" @@ -101,7 +102,6 @@ static int to_debug = 0; // global variables //---------------------------------------------------------------------------- static int ibmphp_shutdown; -static int tid_poll; static struct mutex sem_hpcaccess; // lock access to HPC static struct semaphore semOperations; // lock all operations and // access to data structures @@ -137,7 +137,6 @@ void __init ibmphp_hpc_initvars (void) init_MUTEX_LOCKED (&sem_exit); to_debug = 0; ibmphp_shutdown = 0; - tid_poll = 0; debug ("%s - Exit\n", __FUNCTION__); } @@ -1060,12 +1059,8 @@ static int hpc_poll_thread (void *data) { debug ("%s - Entry\n", __FUNCTION__); - daemonize("hpc_poll"); - allow_signal(SIGKILL); - poll_hpc (); - tid_poll = 0; debug ("%s - Exit\n", __FUNCTION__); return 0; } @@ -1078,17 +1073,18 @@ static int hpc_poll_thread (void *data) *---------------------------------------------------------------------*/ int __init ibmphp_hpc_start_poll_thread (void) { + struct task_struct *task; int rc = 0; debug ("%s - Entry\n", __FUNCTION__); - tid_poll = kernel_thread (hpc_poll_thread, NULL, 0); - if (tid_poll < 0) { + task = kthread_run(hpc_poll_thread, NULL, "hpc_poll"); + if (IS_ERR(task)) { err ("%s - Error, thread not started\n", __FUNCTION__); rc = -1; } …
creator: ebiederm
date: 2007-04-19T07:58:35-00:00

[PATCH] cpqphp: Convert to use the kthread API
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> This patch changes cpqphp to use kthread_run and not kernel_thread and daemonize to startup and setup the cpqphp thread. Cc: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/pci/hotplug/cpqphp_ctrl.c | 12 ++++-------- 1 files changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c index 79ff6b4..c2c06c4 100644 --- a/drivers/pci/hotplug/cpqphp_ctrl.c +++ b/drivers/pci/hotplug/cpqphp_ctrl.c @@ -37,6 +37,7 @@ #include <linux/smp_lock.h> #include <linux/pci.h> #include <linux/pci_hotplug.h> +#include <linux/kthread.h> #include "cpqphp.h" static u32 configure_new_device(struct controller* ctrl, struct pci_func *func, @@ -1746,10 +1747,6 @@ static void pushbutton_helper_thread(unsigned long data) static int event_thread(void* data) { struct controller *ctrl; - lock_kernel(); - daemonize("phpd_event"); - - unlock_kernel(); while (1) { dbg("!!!!event_thread sleeping\n"); @@ -1771,7 +1768,7 @@ static int event_thread(void* data) int cpqhp_event_start_thread(void) { - int pid; + struct task_struct *task; /* initialize our semaphores */ init_MUTEX(&delay_sem); @@ -1779,12 +1776,11 @@ int cpqhp_event_start_thread(void) init_MUTEX_LOCKED(&event_exit); event_finished=0; - pid = kernel_thread(event_thread, NULL, 0); - if (pid < 0) { + task = kthread_run(event_thread, NULL, "phpd_event"); + if (IS_ERR(task)) { err ("Can't start up our event thread\n"); return -1; } - dbg("Our event thread pid = %d\n", pid); return 0; } -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T07:58:36-00:00

[PATCH] pnpbios: Conert to use the kthread API.
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> This patches modifies the pnpbios kernel thread to start with ktrhead_run not kernel_thread and deamonize. Doing this makes the code a little simpler and easier to maintain. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/pnp/pnpbios/core.c | 16 +++++++--------- 1 files changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c index c2ed53f..3a201b7 100644 --- a/drivers/pnp/pnpbios/core.c +++ b/drivers/pnp/pnpbios/core.c @@ -62,6 +62,7 @@ #include <linux/delay.h> #include <linux/acpi.h> #include <linux/freezer.h> +#include <linux/kthread.h> #include <asm/page.h> #include <asm/desc.h> @@ -159,9 +160,7 @@ static int pnp_dock_thread(void * unused) { static struct pnp_docking_station_info now; int docked = -1, d = 0; - daemonize("kpnpbiosd"); - allow_signal(SIGKILL); - while(!unloading && !signal_pending(current)) + while (!unloading) { int status; @@ -170,11 +169,8 @@ static int pnp_dock_thread(void * unused) */ msleep_interruptible(2000); - if(signal_pending(current)) { - if (try_to_freeze()) - continue; - break; - } + if (try_to_freeze()) + continue; status = pnp_bios_dock_station_info(&now); @@ -582,6 +578,7 @@ subsys_initcall(pnpbios_init); static int __init pnpbios_thread_init(void) { + struct task_struct *task; #if defined(CONFIG_PPC_MERGE) if (check_legacy_ioport(PNPBIOS_BASE)) return 0; @@ -590,7 +587,8 @@ static int __init pnpbios_thread_init(void) return 0; #ifdef CONFIG_HOTPLUG init_completion(&unload_sem); - if (kernel_thread(pnp_dock_thread, NULL, CLONE_KERNEL) > 0) + task = kthread_run(pnp_dock_thread, NULL, "kpnpbiosd"); + if (!IS_ERR(task)) unloading = 0; #endif return 0; -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T07:58:37-00:00

[PATCH] sas_scsi_host: Convert to use the kthread API
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> This patch modifies the sas scsi host thread startup to use kthread_run not kernel_thread and deamonize. kthread_run is slightly simpler and more maintainable. Cc: Darrick J. Wong <djwong@us.ibm.com> Cc: James Bottomley <James.Bottomley@SteelEye.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/scsi/libsas/sas_scsi_host.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c index 46ba3a7..7a38ac5 100644 --- a/drivers/scsi/libsas/sas_scsi_host.c +++ b/drivers/scsi/libsas/sas_scsi_host.c @@ -40,6 +40,7 @@ #include <linux/blkdev.h> #include <linux/scatterlist.h> #include <linux/freezer.h> +#include <linux/kthread.h> /* ---------- SCSI Host glue ---------- */ @@ -870,7 +871,6 @@ static int sas_queue_thread(void *_sas_ha) struct sas_ha_struct *sas_ha = _sas_ha; struct scsi_core *core = &sas_ha->core; - daemonize("sas_queue_%d", core->shost->host_no); current->flags |= PF_NOFREEZE; complete(&queue_th_comp); @@ -891,19 +891,20 @@ static int sas_queue_thread(void *_sas_ha) int sas_init_queue(struct sas_ha_struct *sas_ha) { - int res; struct scsi_core *core = &sas_ha->core; + struct task_struct *task; spin_lock_init(&core->task_queue_lock); core->task_queue_size = 0; INIT_LIST_HEAD(&core->task_queue); init_MUTEX_LOCKED(&core->queue_thread_sema); - res = kernel_thread(sas_queue_thread, sas_ha, 0); - if (res >= 0) + task = kthread_run(sas_queue_thread, sas_ha, + "sas_queue_%d", core->shost->host_no); + if (!IS_ERR(task)) wait_for_completion(&queue_th_comp); - return res < 0 ? res : 0; + return IS_ERR(task) ? PTR_ERR(task) : 0; } void sas_shutdown_queue(struct sas_ha_struct *sas_ha) -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T07:58:38-00:00

[PATCH] sparc64/power.c: Convert to use the kthread API
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> This starts the sparc64 powerd using kthread_run instead of kernel_thread and daemonize. Making the code slightly simpler and more maintainable. In addition the unnecessary flush_signals is removed. Cc: David S. Miller <davem@davemloft.net> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- arch/sparc64/kernel/power.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/sparc64/kernel/power.c b/arch/sparc64/kernel/power.c index 699b24b..03feb8b 100644 --- a/arch/sparc64/kernel/power.c +++ b/arch/sparc64/kernel/power.c @@ -13,6 +13,7 @@ #include <linux/interrupt.h> #include <linux/pm.h> #include <linux/syscalls.h> +#include <linux/kthread.h> #include <asm/system.h> #include <asm/auxio.h> @@ -81,15 +82,12 @@ static int powerd(void *__unused) char *argv[] = { "/sbin/shutdown", "-h", "now", NULL }; DECLARE_WAITQUEUE(wait, current); - daemonize("powerd"); - add_wait_queue(&powerd_wait, &wait); again: for (;;) { set_task_state(current, TASK_INTERRUPTIBLE); if (button_pressed) break; - flush_signals(current); schedule(); } __set_current_state(TASK_RUNNING); @@ -128,7 +126,9 @@ static int __devinit power_probe(struct of_device *op, const struct of_device_id poweroff_method = machine_halt; /* able to use the standard halt */ if (has_button_interrupt(irq, op->node)) { - if (kernel_thread(powerd, NULL, CLONE_FS) < 0) { + struct task_struct *task; + task = kthread_urn(powerd, NULL, "powerd"); + if (IS_ERR(task)) { printk("Failed to start power daemon.\n"); return 0; } -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T07:58:39-00:00

[PATCH] s390/net/lcs: Convert to the kthread API
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> Use kthread_run to start the lcs kernel threads not a combination of kernel_thread and daemonize. This makes the code slightly simpler and more maintainable. Cc: Frank Pavlic <fpavlic@de.ibm.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/s390/net/lcs.c | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c index 08a994f..0300d87 100644 --- a/drivers/s390/net/lcs.c +++ b/drivers/s390/net/lcs.c @@ -36,6 +36,7 @@ #include <linux/in.h> #include <linux/igmp.h> #include <linux/delay.h> +#include <linux/kthread.h> #include <net/arp.h> #include <net/ip.h> @@ -1248,7 +1249,6 @@ lcs_register_mc_addresses(void *data) struct in_device *in4_dev; card = (struct lcs_card *) data; - daemonize("regipm"); if (!lcs_do_run_thread(card, LCS_SET_MC_THREAD)) return 0; @@ -1728,11 +1728,10 @@ lcs_start_kernel_thread(struct work_struct *work) struct lcs_card *card = container_of(work, struct lcs_card, kernel_thread_starter); LCS_DBF_TEXT(5, trace, "krnthrd"); if (lcs_do_start_thread(card, LCS_RECOVERY_THREAD)) - kernel_thread(lcs_recovery, (void *) card, SIGCHLD); + kthread_run(lcs_recovery, card, "lcs_recover"); #ifdef CONFIG_IP_MULTICAST if (lcs_do_start_thread(card, LCS_SET_MC_THREAD)) - kernel_thread(lcs_register_mc_addresses, - (void *) card, SIGCHLD); + kernel_run(lcs_register_mc_addresses, card, "regipm"); #endif } @@ -2232,7 +2231,6 @@ lcs_recovery(void *ptr) int rc; card = (struct lcs_card *) ptr; - daemonize("lcs_recover"); LCS_DBF_TEXT(4, trace, "recover1"); if (!lcs_do_run_thread(card, LCS_RECOVERY_THREAD)) -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T07:58:40-00:00

[PATCH] s390 qeth: Convert to use the kthread API
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> This patch modifies the qeth_recover thread to be started with kthread_run not a combination of kernel_thread and daemonize. Resulting in slightly simpler and more maintainable code. Cc: Frank Pavlic <fpavlic@de.ibm.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/s390/net/qeth_main.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index ad7792d..8234846 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c @@ -50,6 +50,7 @@ #include <linux/mii.h> #include <linux/rcupdate.h> #include <linux/ethtool.h> +#include <linux/kthread.h> #include <net/arp.h> #include <net/ip.h> @@ -957,7 +958,6 @@ qeth_recover(void *ptr) int rc = 0; card = (struct qeth_card *) ptr; - daemonize("qeth_recover"); QETH_DBF_TEXT(trace,2,"recover1"); QETH_DBF_HEX(trace, 2, &card, sizeof(void *)); if (!qeth_do_run_thread(card, QETH_RECOVER_THREAD)) @@ -1014,7 +1014,7 @@ qeth_start_kernel_thread(struct work_struct *work) card->write.state != CH_STATE_UP) return; if (qeth_do_start_thread(card, QETH_RECOVER_THREAD)) - kernel_thread(qeth_recover, (void *) card, SIGCHLD); + kthread_run(qeth_recover, card, "qeth_recover"); } -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T07:58:41-00:00

[PATCH] s390/scsi/zfcp_erp: Convert to use the kthread API
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> Modify zfcperp%s to be started with kthread_run not a combination of kernel_thread, daemonize and siginitsetinv making the code slightly simpler and more maintainable. Cc: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/s390/scsi/zfcp_erp.c | 13 ++++++------- 1 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c index 66c0b09..f26536d 100644 --- a/drivers/s390/scsi/zfcp_erp.c +++ b/drivers/s390/scsi/zfcp_erp.c @@ -21,6 +21,7 @@ #define ZFCP_LOG_AREA ZFCP_LOG_AREA_ERP +#include <linux/kthread.h> #include "zfcp_ext.h" static int zfcp_erp_adisc(struct zfcp_port *); @@ -985,12 +986,13 @@ static void zfcp_erp_action_dismiss(struct zfcp_erp_action *erp_action) int zfcp_erp_thread_setup(struct zfcp_adapter *adapter) { - int retval = 0; + struct task_struct *task; atomic_clear_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, &adapter->status); - retval = kernel_thread(zfcp_erp_thread, adapter, SIGCHLD); - if (retval < 0) { + task = kthread_run(zfcp_erp_thread, adapter, + "zfcperp%s", zfcp_get_busid_by_adapter(adapter)); + if (IS_ERR(task)) { ZFCP_LOG_NORMAL("error: creation of erp thread failed for " "adapter %s\n", zfcp_get_busid_by_adapter(adapter)); @@ -1002,7 +1004,7 @@ zfcp_erp_thread_setup(struct zfcp_adapter *adapter) debug_text_event(adapter->erp_dbf, 5, "a_thset_ok"); } - return (retval < 0); + return IS_ERR(task); } /* @@ -1054,9 +1056,6 @@ zfcp_erp_thread(void *data) struct zfcp_erp_action *erp_action; unsigned long flags; - daemonize("zfcperp%s", zfcp_get_busid_by_adapter(adapter)); - /* Block all signals */ - siginitsetinv(&current->blocked, 0); atomic_set_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, &adapter->status); debug_text_event(adapter->erp_dbf, 5, "a_th_run"); wake_up(&adapter->erp_thread_wqh); -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.…
creator: ebiederm
date: 2007-04-19T07:58:42-00:00

[PATCH] arm ecard: Conver to use the kthread API.
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> This patch modifies the startup of kecardd to use kthread_run not a kernel_thread combination of kernel_thread and daemonize. Making the code slightly simpler and more maintainable. Cc: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- arch/arm/kernel/ecard.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/arm/kernel/ecard.c b/arch/arm/kernel/ecard.c index f1c0fb9..6c15f5f 100644 --- a/arch/arm/kernel/ecard.c +++ b/arch/arm/kernel/ecard.c @@ -40,6 +40,7 @@ #include <linux/device.h> #include <linux/init.h> #include <linux/mutex.h> +#include <linux/kthread.h> #include <asm/dma.h> #include <asm/ecard.h> @@ -263,8 +264,6 @@ static int ecard_init_mm(void) static int ecard_task(void * unused) { - daemonize("kecardd"); - /* * Allocate a mm. We're not a lazy-TLB kernel task since we need * to set page table entries where the user space would be. Note @@ -1058,13 +1057,14 @@ ecard_probe(int slot, card_type_t type) */ static int __init ecard_init(void) { - int slot, irqhw, ret; + struct task_struct *task; + int slot, irqhw; - ret = kernel_thread(ecard_task, NULL, CLONE_KERNEL); - if (ret < 0) { + task = kthread_run(ecard_task, NULL, "kecardd"); + if (IS_ERR(task)) { printk(KERN_ERR "Ecard: unable to create kernel thread: %d\n", - ret); - return ret; + PTR_ERR(task)); + return PTR_ERR(task); } printk("Probing expansion cards\n"); -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T07:58:43-00:00

[PATCH] ia64 sn xpc: Convert to use kthread API.
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> This patch starts the xpc kernel threads using kthread_run not a combination of kernel_thread and daemonize. Resuling in slightly simpler and more maintainable code. Cc: Jes Sorensen <jes@sgi.com> Cc: Tony Luck <tony.luck@intel.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- arch/ia64/sn/kernel/xpc_main.c | 31 +++++++++++++------------------ 1 files changed, 13 insertions(+), 18 deletions(-) diff --git a/arch/ia64/sn/kernel/xpc_main.c b/arch/ia64/sn/kernel/xpc_main.c index e336e16..5b53642 100644 --- a/arch/ia64/sn/kernel/xpc_main.c +++ b/arch/ia64/sn/kernel/xpc_main.c @@ -56,6 +56,7 @@ #include <linux/reboot.h> #include <linux/completion.h> #include <linux/kdebug.h> +#include <linux/kthread.h> #include <asm/sn/intr.h> #include <asm/sn/sn_sal.h> #include <asm/uaccess.h> @@ -253,8 +254,6 @@ xpc_hb_checker(void *ignore) /* this thread was marked active by xpc_hb_init() */ - daemonize(XPC_HB_CHECK_THREAD_NAME); - set_cpus_allowed(current, cpumask_of_cpu(XPC_HB_CHECK_CPU)); xpc_hb_check_timeout = jiffies + (xpc_hb_check_interval * HZ); @@ -324,8 +323,6 @@ xpc_hb_checker(void *ignore) static int xpc_initiate_discovery(void *ignore) { - daemonize(XPC_DISCOVERY_THREAD_NAME); - xpc_discovery(); dev_dbg(xpc_part, "discovery thread is exiting\n"); @@ -494,8 +491,6 @@ xpc_activating(void *__partid) dev_dbg(xpc_part, "bringing partition %d up\n", partid); - daemonize("xpc%02d", partid); - /* * This thread needs to run at a realtime priority to prevent a * significant performance degradation. @@ -559,7 +554,7 @@ xpc_activate_partition(struct xpc_partition *part) { partid_t partid = XPC_PARTID(part); unsigned long irq_flags; - pid_t pid; + struct task_struct *task; spin_lock_irqsave(&part->act_lock, irq_flags); @@ -571,9 +566,10 @@ xpc_activate_partition(struct xpc_partition *part) spin_unlock_irqrestore(&part->act_lock, irq_flags); - pid = kernel_thread(xpc_activating, (void *) ((u64) partid), 0); + task = kthread…
creator: ebiederm
date: 2007-04-19T07:58:44-00:00

[PATCH] powerpc pseries eeh: Convert to kthread API
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> This patch modifies the startup of eehd to use kthread_run not a combination of kernel_thread and daemonize. Making the code slightly simpler and more maintainable. Cc: Paul Mackerras <paulus@samba.org> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- arch/powerpc/platforms/pseries/eeh_event.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/pseries/eeh_event.c b/arch/powerpc/platforms/pseries/eeh_event.c index 221dec8..fe7c2e0 100644 --- a/arch/powerpc/platforms/pseries/eeh_event.c +++ b/arch/powerpc/platforms/pseries/eeh_event.c @@ -23,6 +23,7 @@ #include <linux/mutex.h> #include <linux/pci.h> #include <linux/workqueue.h> +#include <linux/kthread.h> #include <asm/eeh_event.h> #include <asm/ppc-pci.h> @@ -59,7 +60,6 @@ static int eeh_event_handler(void * dummy) struct eeh_event *event; struct pci_dn *pdn; - daemonize ("eehd"); set_current_state(TASK_INTERRUPTIBLE); spin_lock_irqsave(&eeh_eventlist_lock, flags); @@ -105,7 +105,7 @@ static int eeh_event_handler(void * dummy) */ static void eeh_thread_launcher(struct work_struct *dummy) { - if (kernel_thread(eeh_event_handler, NULL, CLONE_KERNEL) < 0) + if (IS_ERR(kthread_run(eeh_event_handler, NULL, "eehd"))) printk(KERN_ERR "Failed to start EEH daemon\n"); } -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T07:58:45-00:00

[PATCH] powerpc pseries rtasd: Convert to kthread API.
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> This patch modifies the startup of rtasd to use kthread_run instaed of a combination of kernel_thread and daemonize. Making the code a little simpler and more maintainble. Cc: Paul Mackerras <paulus@samba.org> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- arch/powerpc/platforms/pseries/rtasd.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/platforms/pseries/rtasd.c b/arch/powerpc/platforms/pseries/rtasd.c index 77d0937..919a374 100644 --- a/arch/powerpc/platforms/pseries/rtasd.c +++ b/arch/powerpc/platforms/pseries/rtasd.c @@ -20,6 +20,7 @@ #include <linux/spinlock.h> #include <linux/cpu.h> #include <linux/delay.h> +#include <linux/kthread.h> #include <asm/uaccess.h> #include <asm/io.h> @@ -429,8 +430,6 @@ static int rtasd(void *unused) int event_scan = rtas_token("event-scan"); int rc; - daemonize("rtasd"); - if (event_scan == RTAS_UNKNOWN_SERVICE || get_eventscan_parms() == -1) goto error; @@ -497,7 +496,7 @@ static int __init rtas_init(void) else printk(KERN_ERR "Failed to create error_log proc entry\n"); - if (kernel_thread(rtasd, NULL, CLONE_FS) < 0) + if (IS_ERR(kthread_run(rtasd, NULL, "rtasd"))) printk(KERN_ERR "Failed to start RTAS daemon\n"); return 0; -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T07:58:46-00:00

[PATCH] macintosh/therm_pm72.c: Convert to kthread API.
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> This patch modifies startup of the kfand to use kthread_run not a combination of kernel_thread and daemonize, making the code a little simpler and more maintaintable. Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/macintosh/therm_pm72.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c index b002a4b..7e9cbb7 100644 --- a/drivers/macintosh/therm_pm72.c +++ b/drivers/macintosh/therm_pm72.c @@ -121,6 +121,7 @@ #include <linux/reboot.h> #include <linux/kmod.h> #include <linux/i2c.h> +#include <linux/kthread.h> #include <asm/prom.h> #include <asm/machdep.h> #include <asm/io.h> @@ -161,7 +162,7 @@ static struct slots_pid_state slots_state; static int state; static int cpu_count; static int cpu_pid_type; -static pid_t ctrl_task; +static int ctrl_task; static struct completion ctrl_complete; static int critical_state; static int rackmac; @@ -1779,8 +1780,6 @@ static int call_critical_overtemp(void) */ static int main_control_loop(void *x) { - daemonize("kfand"); - DBG("main_control_loop started\n"); down(&driver_lock); @@ -1859,7 +1858,6 @@ static int main_control_loop(void *x) machine_power_off(); } - // FIXME: Deal with signals elapsed = jiffies - start; if (elapsed < HZ) schedule_timeout_interruptible(HZ - elapsed); @@ -1954,9 +1952,12 @@ static int create_control_loops(void) */ static void start_control_loops(void) { + struct task_struct *task; init_completion(&ctrl_complete); - ctrl_task = kernel_thread(main_control_loop, NULL, SIGCHLD | CLONE_KERNEL); + task = kthread_run(main_control_loop, NULL, "kfand"); + if (!IS_ERR(task)) + ctrl_task = 1; } /* -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T07:58:47-00:00

[PATCH] macintosh/therm_windtunnel.c: Convert to kthread API.
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> Start the g4fand using kthread_run not a combination of kernel_thread and deamonize. This makes the code a little simpler and more maintainable. Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/macintosh/therm_windtunnel.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c index a1d3a98..5d888e7 100644 --- a/drivers/macintosh/therm_windtunnel.c +++ b/drivers/macintosh/therm_windtunnel.c @@ -36,6 +36,7 @@ #include <linux/i2c.h> #include <linux/slab.h> #include <linux/init.h> +#include <linux/kthread.h> #include <asm/prom.h> #include <asm/machdep.h> @@ -62,7 +63,6 @@ I2C_CLIENT_INSMOD; static struct { volatile int running; struct completion completion; - pid_t poll_task; struct semaphore lock; struct of_device *of_dev; @@ -285,7 +285,6 @@ restore_regs( void ) static int control_loop( void *dummy ) { - daemonize("g4fand"); down( &x.lock ); setup_hardware(); @@ -323,7 +322,7 @@ do_attach( struct i2c_adapter *adapter ) if( x.thermostat && x.fan ) { x.running = 1; init_completion( &x.completion ); - x.poll_task = kernel_thread( control_loop, NULL, SIGCHLD | CLONE_KERNEL ); + kthread_run( control_loop, NULL, "g4fand"); } } return ret; -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T07:58:48-00:00

[PATCH] macintosh/adb: Convert to the kthread API
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> This patch modifies the startup of kadbprobe to use kthread_run instead of scheduling a work event which later calls kernel_thread and in the thread calls daemonize and blocks signals. kthread_run is simpler and more maintainable. The variable pid_t adb_probe_task_pid is replaced by a struct task_struct variable named adb_probe_task. Which works equally well with for testing if the current process is the adb_probe thread, does not get confused in the presence of a pid namespace and is easier to compare against current as it is the same type. The result is code that is slightly simpler and easier to maintain. Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/macintosh/adb.c | 32 +++++++------------------------- 1 files changed, 7 insertions(+), 25 deletions(-) diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c index adfea3c..09c5261 100644 --- a/drivers/macintosh/adb.c +++ b/drivers/macintosh/adb.c @@ -35,6 +35,7 @@ #include <linux/spinlock.h> #include <linux/completion.h> #include <linux/device.h> +#include <linux/kthread.h> #include <asm/uaccess.h> #include <asm/semaphore.h> @@ -82,7 +83,7 @@ struct adb_driver *adb_controller; BLOCKING_NOTIFIER_HEAD(adb_client_list); static int adb_got_sleep; static int adb_inited; -static pid_t adb_probe_task_pid; +static struct task_struct *adb_probe_task; static DECLARE_MUTEX(adb_probe_mutex); static struct completion adb_probe_task_comp; static int sleepy_trackpad; @@ -137,8 +138,7 @@ static void printADBreply(struct adb_request *req) static __inline__ void adb_wait_ms(unsigned int ms) { - if (current->pid && adb_probe_task_pid && - adb_probe_task_pid == current->pid) + if (adb_probe_task == current) msleep(ms); else mdelay(ms); @@ -245,35 +245,19 @@ static int adb_scan_bus(void) * This kernel task handles ADB probing. It dies once probing is * completed. */ -…
creator: ebiederm
date: 2007-04-19T07:58:49-00:00

[PATCH] macintosh/mediabay: Convert to kthread API.
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> This patch modifies the startup of the media_bay_task to use kthread_run and not a combination of kernel_thread, deamonize and sigfillset. In addition since we now always want to ignore signals the MB_IGNORE_SIGNALS define is removed along with the test for signal_pending. The result is slightly simpler code that is more maintainable. Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/macintosh/mediabay.c | 11 ++--------- 1 files changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c index c803d2b..90c853e 100644 --- a/drivers/macintosh/mediabay.c +++ b/drivers/macintosh/mediabay.c @@ -20,6 +20,7 @@ #include <linux/stddef.h> #include <linux/init.h> #include <linux/ide.h> +#include <linux/kthread.h> #include <asm/prom.h> #include <asm/pgtable.h> #include <asm/io.h> @@ -35,7 +36,6 @@ #define MB_DEBUG -#define MB_IGNORE_SIGNALS #ifdef MB_DEBUG #define MBDBG(fmt, arg...) printk(KERN_INFO fmt , ## arg) @@ -622,11 +622,6 @@ static int media_bay_task(void *x) { int i; - strcpy(current->comm, "media-bay"); -#ifdef MB_IGNORE_SIGNALS - sigfillset(&current->blocked); -#endif - for (;;) { for (i = 0; i < media_bay_count; ++i) { down(&media_bays[i].lock); @@ -636,8 +631,6 @@ static int media_bay_task(void *x) } msleep_interruptible(MB_POLL_DELAY); - if (signal_pending(current)) - return 0; } } @@ -699,7 +692,7 @@ static int __devinit media_bay_attach(struct macio_dev *mdev, const struct of_de /* Startup kernel thread */ if (i == 0) - kernel_thread(media_bay_task, NULL, CLONE_KERNEL); + kthread_run(media_bay_task, NULL, "media-bay"); return 0; -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T07:58:50-00:00

[PATCH] bluetooth bnep: Convert to kthread API.
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> This patch starts kbenpd using kthread_run replacing a combination of kernel_thread and daemonize. Making the code a little simpler and more maintainable. Cc: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- net/bluetooth/bnep/core.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c index a9f1e88..de3caed 100644 --- a/net/bluetooth/bnep/core.c +++ b/net/bluetooth/bnep/core.c @@ -32,6 +32,7 @@ #include <linux/module.h> #include <linux/kernel.h> +#include <linux/kthread.h> #include <linux/sched.h> #include <linux/signal.h> #include <linux/init.h> @@ -473,7 +474,6 @@ static int bnep_session(void *arg) BT_DBG(""); - daemonize("kbnepd %s", dev->name); set_user_nice(current, -15); init_waitqueue_entry(&wait, current); @@ -539,6 +539,7 @@ static struct device *bnep_get_device(struct bnep_session *session) int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock) { + struct task_struct *task; struct net_device *dev; struct bnep_session *s, *ss; u8 dst[ETH_ALEN], src[ETH_ALEN]; @@ -598,9 +599,10 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock) __bnep_link_session(s); - err = kernel_thread(bnep_session, s, CLONE_KERNEL); - if (err < 0) { + task = kthread_run(bnep_session, s, "kbnepd %s", dev->name); + if (IS_ERR(task)) { /* Session thread start failed, gotta cleanup. */ + err = PTR_ERR(task); unregister_netdev(dev); __bnep_unlink_session(s); goto failed; -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T07:58:51-00:00

[PATCH] bluetooth cmtp: Convert to use kthread API.
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> This patch modifies the kcmptd_ctr_%d daemon using kthread_run instead of a combination of kernel_thread and daemonize making the code a little simpler and more maintainable. Cc: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- net/bluetooth/cmtp/core.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/net/bluetooth/cmtp/core.c b/net/bluetooth/cmtp/core.c index e1b9db9..993303f 100644 --- a/net/bluetooth/cmtp/core.c +++ b/net/bluetooth/cmtp/core.c @@ -35,6 +35,7 @@ #include <linux/file.h> #include <linux/init.h> #include <linux/freezer.h> +#include <linux/kthread.h> #include <net/sock.h> #include <linux/isdn/capilli.h> @@ -286,7 +287,6 @@ static int cmtp_session(void *arg) BT_DBG("session %p", session); - daemonize("kcmtpd_ctr_%d", session->num); set_user_nice(current, -15); init_waitqueue_entry(&wait, current); @@ -329,6 +329,7 @@ static int cmtp_session(void *arg) int cmtp_add_connection(struct cmtp_connadd_req *req, struct socket *sock) { struct cmtp_session *session, *s; + struct task_struct *task; bdaddr_t src, dst; int i, err; @@ -375,8 +376,9 @@ int cmtp_add_connection(struct cmtp_connadd_req *req, struct socket *sock) __cmtp_link_session(session); - err = kernel_thread(cmtp_session, session, CLONE_KERNEL); - if (err < 0) + task = kthread_run(cmtp_session, session, "kcmtpd_ctr_%d", session->num); + err = PTR_ERR(task); + if (IS_ERR(task)) goto unlink; if (!(session->flags & (1 << CMTP_LOOPBACK))) { -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T07:58:52-00:00

[PATCH] bluetooth hidp: Convert to kthread API.
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> This patch starts up khidp using kthread_run instead of kernel_thread and daemonize, resulting is slightly simpler and more maintainable code. Cc: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- net/bluetooth/hidp/core.c | 29 ++++++++++++++++------------- 1 files changed, 16 insertions(+), 13 deletions(-) diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index df2c471..1c9b202 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c @@ -36,6 +36,7 @@ #include <linux/init.h> #include <linux/wait.h> #include <linux/freezer.h> +#include <linux/kthread.h> #include <net/sock.h> #include <linux/input.h> @@ -531,22 +532,11 @@ static int hidp_session(void *arg) struct sock *ctrl_sk = session->ctrl_sock->sk; struct sock *intr_sk = session->intr_sock->sk; struct sk_buff *skb; - int vendor = 0x0000, product = 0x0000; wait_queue_t ctrl_wait, intr_wait; BT_DBG("session %p", session); - if (session->input) { - vendor = session->input->id.vendor; - product = session->input->id.product; - } - - if (session->hid) { - vendor = session->hid->vendor; - product = session->hid->product; - } - daemonize("khidpd_%04x%04x", vendor, product); set_user_nice(current, -15); init_waitqueue_entry(&ctrl_wait, current); @@ -747,7 +737,9 @@ static inline void hidp_setup_hid(struct hidp_session *session, struct hidp_conn int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock, struct socket *intr_sock) { + int vendor = 0x0000, product = 0x0000; struct hidp_session *session, *s; + struct task_struct *task; int err; BT_DBG(""); @@ -834,8 +826,19 @@ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock, hidp_set_timer(session); - err = kernel_thread(hidp_session, session, CLONE_KERNEL); - if (err < 0) + if (session->input) { + vendor = session->input->id.vendor; + product = session->input->id.product; + } + + if (session->hid) {…
creator: ebiederm
date: 2007-04-19T07:58:53-00:00

[PATCH] bluetooth rfcomm: Convert to kthread API.
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> This patch starts krfcommd using kthread_run instead of a combination of kernel_thread and daemonize making the code slightly simpler and more maintainable. Cc: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- net/bluetooth/rfcomm/core.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index 34f993a..baaad49 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c @@ -38,6 +38,7 @@ #include <linux/net.h> #include <linux/mutex.h> #include <linux/freezer.h> +#include <linux/kthread.h> #include <net/sock.h> #include <asm/uaccess.h> @@ -1938,7 +1939,6 @@ static int rfcomm_run(void *unused) atomic_inc(&running); - daemonize("krfcommd"); set_user_nice(current, -10); BT_DBG(""); @@ -2058,7 +2058,7 @@ static int __init rfcomm_init(void) hci_register_cb(&rfcomm_cb); - kernel_thread(rfcomm_run, NULL, CLONE_KERNEL); + kthread_run(rfcomm_run, NULL, "krfcommd"); if (class_create_file(bt_class, &class_attr_rfcomm_dlc) < 0) BT_ERR("Failed to create RFCOMM info file"); -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T07:58:54-00:00

[PATCH] fs/afs: Convert to kthread API.
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> This patch modifies the startup of kafscmd, kafsasyncd, and kafstimod to use kthread_run instead of a combination of kernel_thread and daemonize making the code slightly simpler and more maintainable. In addition since by default all signals are ignored when delivered to a kernel thread the code to flush signals has been removed. Cc: David Howells <dhowells@redhat.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- fs/afs/cmservice.c | 10 +++++----- fs/afs/internal.h | 11 ----------- fs/afs/kafsasyncd.c | 17 ++++++----------- fs/afs/kafstimod.c | 16 ++++++---------- 4 files changed, 17 insertions(+), 37 deletions(-) diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c index 3d097fd..f7e2355 100644 --- a/fs/afs/cmservice.c +++ b/fs/afs/cmservice.c @@ -13,6 +13,7 @@ #include <linux/init.h> #include <linux/sched.h> #include <linux/completion.h> +#include <linux/kthread.h> #include "server.h" #include "cell.h" #include "transport.h" @@ -120,8 +121,6 @@ static int kafscmd(void *arg) printk(KERN_INFO "kAFS: Started kafscmd %d\n", current->pid); - daemonize("kafscmd"); - complete(&kafscmd_alive); /* loop around looking for things to attend to */ @@ -133,7 +132,6 @@ static int kafscmd(void *arg) for (;;) { set_current_state(TASK_INTERRUPTIBLE); if (!list_empty(&kafscmd_attention_list) || - signal_pending(current) || kafscmd_die) break; @@ -297,8 +295,10 @@ int afscm_start(void) down_write(&afscm_sem); if (!afscm_usage) { - ret = kernel_thread(kafscmd, NULL, 0); - if (ret < 0) + struct task_struct *task; + task = kthread_run(kafscmd, NULL, "kafscmd"); + ret = PTR_ERR(task); + if (IS_ERR(task)) goto out; wait_for_completion(&kafscmd_alive); diff --git a/fs/afs/internal.h b/fs/afs/internal.h index 5151d5d..2d667b7 100644 --- a/fs/afs/internal.h +++ b/fs/afs/internal.h @@ -40,17 +40,6 @@ #define _net(FMT, a...) do { } while(0) #endif -static inline void afs_discard_my_signals(void) -{ - while (signal_pending(current)…
creator: ebiederm
date: 2007-04-19T07:58:55-00:00

[PATCH] net/rxrpc: Convert to kthread API.
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> This patch modifies the startup of krxtimod, krxiod, and krxsecd to use kthread_run instead of a combination of kernel_thread and daemonize making the code slightly simpler and more maintainable. In addition since by default all signals are ignored when delivered to a kernel thread the code to flush signals has been removed. Cc: David Howells <dhowells@redhat.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- net/rxrpc/internal.h | 11 ----------- net/rxrpc/krxiod.c | 16 ++++++++-------- net/rxrpc/krxsecd.c | 16 ++++++++-------- net/rxrpc/krxtimod.c | 15 ++++++--------- 4 files changed, 22 insertions(+), 36 deletions(-) diff --git a/net/rxrpc/internal.h b/net/rxrpc/internal.h index cc0c579..1dd69aa 100644 --- a/net/rxrpc/internal.h +++ b/net/rxrpc/internal.h @@ -49,17 +49,6 @@ __RXACCT_DECL(extern atomic_t rxrpc_message_count); #define _net(FMT, a...) do { if (rxrpc_knet) knet (FMT , ##a); } while(0) #endif -static inline void rxrpc_discard_my_signals(void) -{ - while (signal_pending(current)) { - siginfo_t sinfo; - - spin_lock_irq(&current->sighand->siglock); - dequeue_signal(current, &current->blocked, &sinfo); - spin_unlock_irq(&current->sighand->siglock); - } -} - /* * call.c */ diff --git a/net/rxrpc/krxiod.c b/net/rxrpc/krxiod.c index bbbcd6c..c590ccd 100644 --- a/net/rxrpc/krxiod.c +++ b/net/rxrpc/krxiod.c @@ -14,6 +14,7 @@ #include <linux/spinlock.h> #include <linux/init.h> #include <linux/freezer.h> +#include <linux/kthread.h> #include <rxrpc/krxiod.h> #include <rxrpc/transport.h> #include <rxrpc/peer.h> @@ -43,8 +44,6 @@ static int rxrpc_krxiod(void *arg) printk("Started krxiod %d\n",current->pid); - daemonize("krxiod"); - /* loop around waiting for work to do */ do { /* wait for work or to be told to exit */ @@ -57,8 +56,7 @@ static int rxrpc_krxiod(void *arg) for (;;) { set_current_state(TASK_INTERRUPTIBLE); if (atomic_read(&rxrpc_krxiod_qcount) || - rxrpc_krxiod_die || - signal_pending(curren…
creator: ebiederm
date: 2007-04-19T07:58:56-00:00

[PATCH] ipv4/ipvs: Convert to kthread API
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> Modify startup of ipvs sync threads to use kthread_run instead of a weird combination of calling kernel_thread to start a fork_sync_thread whose hole purpose in life was to call kernel_thread again starting the actually sync thread which called daemonize. To use kthread_run I had to move the name calcuation from sync_thread into start_sync_thread resulting in a small amount of code motion. The result is simpler and more maintainable piece of code. Cc: Wensong Zhang <wensong@linux-vs.org> Cc: Julian Anastasov <ja@ssi.bg> Cc: Simon Horman <horms@verge.net.au> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- net/ipv4/ipvs/ip_vs_sync.c | 49 ++++++++++--------------------------------- 1 files changed, 12 insertions(+), 37 deletions(-) diff --git a/net/ipv4/ipvs/ip_vs_sync.c b/net/ipv4/ipvs/ip_vs_sync.c index 7ea2d98..c4be9dc 100644 --- a/net/ipv4/ipvs/ip_vs_sync.c +++ b/net/ipv4/ipvs/ip_vs_sync.c @@ -29,6 +29,7 @@ #include <linux/in.h> #include <linux/igmp.h> /* for ip_mc_join_group */ #include <linux/udp.h> +#include <linux/kthread.h> #include <net/ip.h> #include <net/sock.h> @@ -750,34 +751,23 @@ static int sync_thread(void *startup) DECLARE_WAITQUEUE(wait, current); mm_segment_t oldmm; int state; - const char *name; /* increase the module use count */ ip_vs_use_count_inc(); - if (ip_vs_sync_state & IP_VS_STATE_MASTER && !sync_master_pid) { + if (ip_vs_sync_state & IP_VS_STATE_MASTER && !sync_master_pid) state = IP_VS_STATE_MASTER; - name = "ipvs_syncmaster"; - } else if (ip_vs_sync_state & IP_VS_STATE_BACKUP && !sync_backup_pid) { + else if (ip_vs_sync_state & IP_VS_STATE_BACKUP && !sync_backup_pid) state = IP_VS_STATE_BACKUP; - name = "ipvs_syncbackup"; - } else { + else { IP_VS_BUG(); ip_vs_use_count_dec(); return -EINVAL; } - daemonize(name); - oldmm = get_fs(); set_fs(KERNEL_DS); - /* Block all signals */ - spin_lock_irq(&current->sighand->siglock); - siginitsetinv(&current->blocked, 0); - recalc_sigpendi…
creator: ebiederm
date: 2007-04-19T07:58:57-00:00

[PATCH] saa7134-tvaudio: Convert to kthread API.
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> It is my goal to replace all kernel code that handles signals from user space, calls kernel_thread or calls daemonize. All of which the kthread_api makes unncessary. Handling signals from user space is a maintenance problem becuase using a kernel thread is an implementation detail and if user space cares it does not allow us to change the implementation. Calling daemonize is a problem because it has to undo a continually changing set of state generated by user space, requiring the implemetation to change continually. kernel_thread is a problem because it returns a pid_t value. Numeric pids are inherently racy and in the presence of a pid namespace they are no longer global making them useless for general use in the kernel. So this patch renames the pid member of struct saa7134_thread started and changes it's type from pid_t to int. All it has ever been used for is to detect if the kernel thread is has been started so this works. allow_signal(SIGTERM) and the calls to signal_pending have been removed they are needed for the driver to operation. The startup of tvaudio_thread and tvaudio_thread_dep have been modified to use kthread_run instead of a combination of kernel_thread and daemonize. The result is code that is slightly simpler and more maintainable. Cc: Hartmut Hackmann <hartmut.hackmann@t-online.de> Cc: Mauro Carvalho Chehab <mchehab@infradead.org> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/media/video/saa7134/saa7134-tvaudio.c | 27 ++++++++++++------------- drivers/media/video/saa7134/saa7134.h | 2 +- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c index 7b56041..b636cb1 100644 --- a/drivers/media/video/saa7134/saa7134-tvaudio.c +++ b/drivers/media/video/saa7134/saa7134-tvaudio.c @@ -27,6 +27,7 @@ #include <linux/kernel.h> #include <linux/slab.h> #include <linux/delay.h> +#inclu…
creator: ebiederm
date: 2007-04-19T07:58:58-00:00

[PATCH] nfs lockd reclaimer: Convert to kthread API
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> Start the reclaimer thread using kthread_run instead of a combination of kernel_thread and daemonize. The small amount of signal handling code is also removed as it makes no sense and is a maintenance problem to handle signals in kernel threads. Cc: Neil Brown <neilb@suse.de> Cc: Trond Myklebust <trond.myklebust@fys.uio.no> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- fs/lockd/clntlock.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-) diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c index f4d45d4..83591f6 100644 --- a/fs/lockd/clntlock.c +++ b/fs/lockd/clntlock.c @@ -9,6 +9,7 @@ #include <linux/module.h> #include <linux/types.h> #include <linux/time.h> +#include <linux/kthread.h> #include <linux/nfs_fs.h> #include <linux/sunrpc/clnt.h> #include <linux/sunrpc/svc.h> @@ -153,7 +154,7 @@ nlmclnt_recovery(struct nlm_host *host) if (!host->h_reclaiming++) { nlm_get_host(host); __module_get(THIS_MODULE); - if (kernel_thread(reclaimer, host, CLONE_KERNEL) < 0) + if (IS_ERR(kthread_run(reclaimer, host, "%s-reclaim", host->h_name))) module_put(THIS_MODULE); } } @@ -166,9 +167,6 @@ reclaimer(void *ptr) struct file_lock *fl, *next; u32 nsmstate; - daemonize("%s-reclaim", host->h_name); - allow_signal(SIGKILL); - down_write(&host->h_rwsem); /* This one ensures that our parent doesn't terminate while the @@ -193,8 +191,6 @@ restart: list_del_init(&fl->fl_u.nfs_fl.list); /* Why are we leaking memory here? --okir */ - if (signalled()) - continue; if (nlmclnt_reclaim(host, fl) != 0) continue; list_add_tail(&fl->fl_u.nfs_fl.list, &host->h_granted); -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T07:58:59-00:00

[PATCH] nfsv4 delegation: Convert to kthread API
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> To start the nfsv4-delegreturn thread this patch uses kthread_run instead of a combination of kernel_thread and daemonize. In addition allow_signal(SIGKILL) is removed from the expire delegations thread. Cc: Neil Brown <neilb@suse.de> Cc: Trond Myklebust <trond.myklebust@fys.uio.no> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- fs/nfs/delegation.c | 11 ++++------- 1 files changed, 4 insertions(+), 7 deletions(-) diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index 841c99a..7b9b88c 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c @@ -232,7 +232,6 @@ int nfs_do_expire_all_delegations(void *ptr) struct nfs_delegation *delegation; struct inode *inode; - allow_signal(SIGKILL); restart: spin_lock(&clp->cl_lock); if (test_bit(NFS4CLNT_STATE_RECOVER, &clp->cl_state) != 0) @@ -310,8 +309,6 @@ static int recall_thread(void *data) struct nfs_inode *nfsi = NFS_I(inode); struct nfs_delegation *delegation; - daemonize("nfsv4-delegreturn"); - nfs_msync_inode(inode); down_read(&clp->cl_sem); down_write(&nfsi->rwsem); @@ -350,18 +347,18 @@ int nfs_async_inode_return_delegation(struct inode *inode, const nfs4_stateid *s .inode = inode, .stateid = stateid, }; - int status; + struct task_struct *task; init_completion(&data.started); __module_get(THIS_MODULE); - status = kernel_thread(recall_thread, &data, CLONE_KERNEL); - if (status < 0) + task = kthread_run(recall_thread, &data, "nfsv4-delegreturn"); + if (IS_ERR(task)) goto out_module_put; wait_for_completion(&data.started); return data.result; out_module_put: module_put(THIS_MODULE); - return status; + return PTR_ERR(task); } /* -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T07:59:00-00:00

[PATCH] nfsd/nfs4state: Remove unnecessary daemonize call.
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> Cc: Neil Brown <neilb@suse.de> Cc: Trond Myklebust <trond.myklebust@fys.uio.no> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- fs/nfsd/nfs4state.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 678f3be..3cc8ce4 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -1326,8 +1326,6 @@ do_recall(void *__dp) { struct nfs4_delegation *dp = __dp; - daemonize("nfsv4-recall"); - nfsd4_cb_recall(dp); return 0; } -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T07:59:01-00:00

[PATCH] nfs4state reclaimer: Remove unnecessary allow_signal
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> Cc: Neil Brown <neilb@suse.de> Cc: Trond Myklebust <trond.myklebust@fys.uio.no> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- fs/nfs/nfs4state.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 5fffbdf..d16393f 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c @@ -775,8 +775,6 @@ static int reclaimer(void *ptr) struct rpc_cred *cred; int status = 0; - allow_signal(SIGKILL); - /* Ensure exclusive access to NFSv4 state */ lock_kernel(); down_write(&clp->cl_sem); -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T07:59:02-00:00

[PATCH] smbfs: Remove unnecessary allow_signal
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- fs/smbfs/smbiod.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/fs/smbfs/smbiod.c b/fs/smbfs/smbiod.c index 3e61b44..67176af 100644 --- a/fs/smbfs/smbiod.c +++ b/fs/smbfs/smbiod.c @@ -298,8 +298,6 @@ out: */ static int smbiod(void *unused) { - allow_signal(SIGKILL); - VERBOSE("SMB Kernel thread starting (%d) ...\n", current->pid); for (;;) { -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T07:59:03-00:00

[PATCH] dvb_en_50221: Convert to kthread API
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> This patch is a minimal transformation to use the kthread API doing it's best to preserve the existing logic. Instead of starting kdvb-ca by calling kernel_thread, daemonize and sigfillset we kthread_run is used. Instead of tracking the pid of the running thread we instead simply keep a flag to indicate that the current thread is running, as that is all the pid is really used for. And finally the kill_proc sending signal 0 to the kernel thread to ensure it is alive before we wait for it to shutdown is removed. The kthread API does not provide the pid so we don't have that information readily available and the test is just silly. If there is no shutdown race the test is a useless confirmation of that the thread is running. If there is a race the test doesn't fix it and we should fix the race properly. Cc: Andrew de Quincey <adq_dvb@lidskialf.net> Cc: Mauro Carvalho Chehab <mchehab@infradead.org> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/media/dvb/dvb-core/dvb_ca_en50221.c | 46 ++++++++++---------------- 1 files changed, 18 insertions(+), 28 deletions(-) diff --git a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c index 2a03bf5..b28bc15 100644 --- a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c +++ b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c @@ -37,6 +37,7 @@ #include <linux/delay.h> #include <linux/spinlock.h> #include <linux/sched.h> +#include <linux/kthread.h> #include "dvb_ca_en50221.h" #include "dvb_ringbuffer.h" @@ -139,8 +140,8 @@ struct dvb_ca_private { /* wait queues for read() and write() operations */ wait_queue_head_t wait_queue; - /* PID of the monitoring thread */ - pid_t thread_pid; + /* Flag indicating the monitoring thread is running */ + int thread_running; /* Wait queue used when shutting thread down */ wait_queue_head_t thread_queue; @@ -982,7 +983,6 @@ static void dvb_ca_en50221_thread_update_delay(struct dvb_ca_private *ca) static …
creator: ebiederm
date: 2007-04-19T07:59:04-00:00

[PATCH] md: Remove broken SIGKILL support
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> Currently md_thread calls allow_signal so it can receive a SIGKILL but then does nothing with it except flush the sigkill so that it not can use an interruptible sleep. This whole dance is silly so remove the unnecessary and broken signal handling logic. Cc: Neil Brown <neilb@suse.de> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/md/md.c | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index 1299c23..dfd0cb9 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -4542,17 +4542,11 @@ static int md_thread(void * arg) */ current->flags |= PF_NOFREEZE; - allow_signal(SIGKILL); while (!kthread_should_stop()) { /* We need to wait INTERRUPTIBLE so that * we don't add to the load-average. - * That means we need to be sure no signals are - * pending */ - if (signal_pending(current)) - flush_signals(current); - wait_event_interruptible_timeout (thread->wqueue, test_bit(THREAD_WAKEUP, &thread->flags) -- 1.5.0.g53756 _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T07:59:05-00:00

[PATCH] synchro_test: Convert to the kthread API.
type: item
description: From: Eric W. Biederman <ebiederm@xmission.com> Cc: David Howells <dhowells@redhat.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- kernel/synchro-test.c | 16 ++++++---------- 1 files changed, 6 insertions(+), 10 deletions(-) diff --git a/kernel/synchro-test.c b/kernel/synchro-test.c index a4747a6..b1d7fd6 100644 --- a/kernel/synchro-test.c +++ b/kernel/synchro-test.c @@ -30,6 +30,7 @@ #include <linux/timer.h> #include <linux/completion.h> #include <linux/mutex.h> +#include <linux/kthread.h> #define MAX_THREADS 64 @@ -224,7 +225,6 @@ static int mutexer(void *arg) { unsigned int N = (unsigned long) arg; - daemonize("Mutex%u", N); set_user_nice(current, 19); while (atomic_read(&do_stuff)) { @@ -246,7 +246,6 @@ static int semaphorer(void *arg) { unsigned int N = (unsigned long) arg; - daemonize("Sem%u", N); set_user_nice(current, 19); while (atomic_read(&do_stuff)) { @@ -268,7 +267,6 @@ static int reader(void *arg) { unsigned int N = (unsigned long) arg; - daemonize("Read%u", N); set_user_nice(current, 19); while (atomic_read(&do_stuff)) { @@ -292,7 +290,6 @@ static int writer(void *arg) { unsigned int N = (unsigned long) arg; - daemonize("Write%u", N); set_user_nice(current, 19); while (atomic_read(&do_stuff)) { @@ -316,7 +313,6 @@ static int downgrader(void *arg) { unsigned int N = (unsigned long) arg; - daemonize("Down%u", N); set_user_nice(current, 19); while (atomic_read(&do_stuff)) { @@ -433,27 +429,27 @@ static int __init do_tests(void) for (loop = 0; loop < MAX_THREADS; loop++) { if (loop < nummx) { init_completion(&mx_comp[loop]); - kernel_thread(mutexer, (void *) loop, 0); + kthread_run(mutexer, (void *) loop, "Mutex%u", loop); } if (loop < numsm) { init_completion(&sm_comp[loop]); - kernel_thread(semaphorer, (void *) loop, 0); + kthread_run(semaphorer, (void *) loop, "Sem%u", loop); } if (loop < numrd) { init_completion(&rd_comp[loop]); - kernel_thread(reader, (void *) loop, 0); + kthread_run(reader, (void *) loop, "Read%u", loop); } if (loo…
creator: ebiederm
date: 2007-04-19T07:59:06-00:00

[PATCH] synchro_test: Convert to the kthread API.
type: item
description: _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T07:59:07-00:00

Re: [PATCH] s390/net/lcs: Convert to the kthread API
type: item
description: ACK for both patches, thank you Eric for the patches, will add them to my patchset for Jeff. Frank On Thu, Apr 19, 2007 at 01:58:40AM -0600, Eric W. Biederman wrote: > From: Eric W. Biederman <ebiederm@xmission.com> > > Use kthread_run to start the lcs kernel threads not a > combination of kernel_thread and daemonize. This makes > the code slightly simpler and more maintainable. > > Cc: Frank Pavlic <fpavlic@de.ibm.com> > Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> > --- > drivers/s390/net/lcs.c | 8 +++----- > 1 files changed, 3 insertions(+), 5 deletions(-) > > diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c > index 08a994f..0300d87 100644 > --- a/drivers/s390/net/lcs.c > +++ b/drivers/s390/net/lcs.c > @@ -36,6 +36,7 @@ > #include <linux/in.h> > #include <linux/igmp.h> > #include <linux/delay.h> > +#include <linux/kthread.h> > #include <net/arp.h> > #include <net/ip.h> > > @@ -1248,7 +1249,6 @@ lcs_register_mc_addresses(void *data) > struct in_device *in4_dev; > > card = (struct lcs_card *) data; > - daemonize("regipm"); > > if (!lcs_do_run_thread(card, LCS_SET_MC_THREAD)) > return 0; > @@ -1728,11 +1728,10 @@ lcs_start_kernel_thread(struct work_struct *work) > struct lcs_card *card = container_of(work, struct lcs_card, kernel_thread_starter); > LCS_DBF_TEXT(5, trace, "krnthrd"); > if (lcs_do_start_thread(card, LCS_RECOVERY_THREAD)) > - kernel_thread(lcs_recovery, (void *) card, SIGCHLD); > + kthread_run(lcs_recovery, card, "lcs_recover"); > #ifdef CONFIG_IP_MULTICAST > if (lcs_do_start_thread(card, LCS_SET_MC_THREAD)) > - kernel_thread(lcs_register_mc_addresses, > - (void *) card, SIGCHLD); > + kernel_run(lcs_register_mc_addresses, card, "regipm"); > #endif > } > > @@ -2232,7 +2231,6 @@ lcs_recovery(void *ptr) > int rc; > > card = (struct lcs_card *) ptr; > - daemonize("lcs_recover"); > > LCS_DBF_TEXT(4, trace, "recover1"); > if (!lcs_do_run_thread(card, LCS_RECOVERY_THREAD)) > -- > 1.5.0.g53756 ___________________________________________…
creator: Frank Pavlic
date: 2007-04-19T08:19:55-00:00

Re: [PATCH] ipv4/ipvs: Convert to kthread API
type: item
description: On Thu, Apr 19, 2007 at 01:58:57AM -0600, Eric W. Biederman wrote: > From: Eric W. Biederman <ebiederm@xmission.com> > > Modify startup of ipvs sync threads to use kthread_run > instead of a weird combination of calling kernel_thread > to start a fork_sync_thread whose hole purpose in life was > to call kernel_thread again starting the actually sync thread > which called daemonize. > > To use kthread_run I had to move the name calcuation from > sync_thread into start_sync_thread resulting in a small > amount of code motion. > > The result is simpler and more maintainable piece of code. Thanks Eric, I'll review this and get back to you shortly. -- Horms H: http://www.vergenet.net/~horms/ W: http://www.valinux.co.jp/en/ _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: Simon Horman
date: 2007-04-19T09:04:36-00:00

Re: [PATCH] fs/afs: Convert to kthread API.
type: item
description: Eric W. Biederman <ebiederm@xmission.com> wrote: > This patch modifies the startup of kafscmd, kafsasyncd, and kafstimod > to use kthread_run instead of a combination of kernel_thread and > daemonize making the code slightly simpler and more maintainable. Please drop this patch for the moment as I have my own patches to convert them to keventd-type threads, in addition to implementing a host of other changes. David _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: David Howells
date: 2007-04-19T09:32:07-00:00

Re: [PATCH] net/rxrpc: Convert to kthread API.
type: item
description: Eric W. Biederman <ebiederm@xmission.com> wrote: > This patch modifies the startup of krxtimod, krxiod, and krxsecd > to use kthread_run instead of a combination of kernel_thread > and daemonize making the code slightly simpler and more maintainable. Again, please drop in favour of my RxRPC patches. David _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: David Howells
date: 2007-04-19T09:32:38-00:00

Re: [PATCH] net/rxrpc: Convert to kthread API.
type: item
description: David Howells <dhowells@redhat.com> writes: > Eric W. Biederman <ebiederm@xmission.com> wrote: > >> This patch modifies the startup of krxtimod, krxiod, and krxsecd >> to use kthread_run instead of a combination of kernel_thread >> and daemonize making the code slightly simpler and more maintainable. > > Again, please drop in favour of my RxRPC patches. What is the ETA on your patches? Eric _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T13:05:32-00:00

Getting the new RxRPC patches upstream
type: item
description: Eric W. Biederman <ebiederm@xmission.com> wrote: > What is the ETA on your patches? That depends on Dave Miller now, I think. I'm assuming they need to go through the network GIT tree to get to Linus. Certainly Andrew Morton seems to think so. David _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: David Howells
date: 2007-04-19T14:18:23-00:00

Re: [PATCH] nfs lockd reclaimer: Convert to kthread API
type: item
description: On Thu, 2007-04-19 at 01:58 -0600, Eric W. Biederman wrote: > From: Eric W. Biederman <ebiederm@xmission.com> > > Start the reclaimer thread using kthread_run instead > of a combination of kernel_thread and daemonize. > The small amount of signal handling code is also removed > as it makes no sense and is a maintenance problem to handle > signals in kernel threads. Vetoed. Removing stuff just because it doesn't make sense to you is not acceptable. Signal handling in reclaimer threads is there in order to allow administrators to deal with the case where the server never comes up again. Trond _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: Trond Myklebust
date: 2007-04-19T16:21:50-00:00

Re: [PATCH] nfsv4 delegation: Convert to kthread API
type: item
description: On Thu, 2007-04-19 at 01:59 -0600, Eric W. Biederman wrote: > From: Eric W. Biederman <ebiederm@xmission.com> > > To start the nfsv4-delegreturn thread this patch uses > kthread_run instead of a combination of kernel_thread > and daemonize. > > In addition allow_signal(SIGKILL) is removed from > the expire delegations thread. Again vetoed, for the same reason. Trond _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: Trond Myklebust
date: 2007-04-19T16:22:24-00:00

Re: [PATCH] nfs4state reclaimer: Remove unnecessary allow_signal
type: item
description: On Thu, 2007-04-19 at 01:59 -0600, Eric W. Biederman wrote: > From: Eric W. Biederman <ebiederm@xmission.com> > > Cc: Neil Brown <neilb@suse.de> > Cc: Trond Myklebust <trond.myklebust@fys.uio.no> > Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> > --- > fs/nfs/nfs4state.c | 2 -- > 1 files changed, 0 insertions(+), 2 deletions(-) > > diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c > index 5fffbdf..d16393f 100644 > --- a/fs/nfs/nfs4state.c > +++ b/fs/nfs/nfs4state.c > @@ -775,8 +775,6 @@ static int reclaimer(void *ptr) > struct rpc_cred *cred; > int status = 0; > > - allow_signal(SIGKILL); > - > /* Ensure exclusive access to NFSv4 state */ > lock_kernel(); > down_write(&clp->cl_sem); Ditto... _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: Trond Myklebust
date: 2007-04-19T16:26:42-00:00

Re: [PATCH] mtd_blkdevs: Convert to use the kthread API
type: item
description: On Thu, Apr 19, 2007 at 12:55:28AM -0600, Eric W. Biederman wrote: > From: Eric W. Biederman <ebiederm@xmission.com> - unquoted > > thread_run is used intead of kernel_thread, daemonize, and mucking > around blocking signals directly. Please don't do incomplete transitions like that. We don't really want people to use kthread_run, but not the kthread stopping mechanisms, because people will simply forget about that bit and we'll never get rid of the enormous amount of, erm creativity, in handling kernel thread stopping. This is just the first patch in your series where the thread is mutable, but it equally applies to all following patches where this is the case aswell. _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: Christoph Hellwig
date: 2007-04-19T16:47:46-00:00

Re: [PATCH] mtd_blkdevs: Convert to use the kthread API
type: item
description: Christoph Hellwig <hch@infradead.org> writes: > On Thu, Apr 19, 2007 at 12:55:28AM -0600, Eric W. Biederman wrote: >> From: Eric W. Biederman <ebiederm@xmission.com> - unquoted >> >> thread_run is used intead of kernel_thread, daemonize, and mucking >> around blocking signals directly. > > Please don't do incomplete transitions like that. We don't really > want people to use kthread_run, but not the kthread stopping > mechanisms, because people will simply forget about that bit and > we'll never get rid of the enormous amount of, erm creativity, in > handling kernel thread stopping. > > This is just the first patch in your series where the thread is mutable, > but it equally applies to all following patches where this is the case > aswell. I don't really care about the creativity. Although it would be nice if it wasn't there. I deliberately left it in so I would be certain my patches were correct. I care about killing the maintenance and forward development roadblocks that are kernel_thread and daemonize. And the user interface problem that is handling signals in kernel threads. Eric _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T19:13:22-00:00

Re: [PATCH] nfs lockd reclaimer: Convert to kthread API
type: item
description: Trond Myklebust <trond.myklebust@fys.uio.no> writes: > On Thu, 2007-04-19 at 01:58 -0600, Eric W. Biederman wrote: >> From: Eric W. Biederman <ebiederm@xmission.com> >> >> Start the reclaimer thread using kthread_run instead >> of a combination of kernel_thread and daemonize. >> The small amount of signal handling code is also removed >> as it makes no sense and is a maintenance problem to handle >> signals in kernel threads. > > Vetoed. Removing stuff just because it doesn't make sense to you is not > acceptable. > > Signal handling in reclaimer threads is there in order to allow > administrators to deal with the case where the server never comes up > again. Doesn't unmount handle that? Regardless kernel threads should be an implementation detail not a part of the user interface. If kernel threads are part of the user interface it makes them very hard to change. So it isn't that it doesn't make sense to me it is that it looks fundamentally broken and like a maintenance nightmare. I would rather kill kernel threads then try and simulate them when the kernel implementation has changed and kernel threads are not visible. If I could be convinced that signal handling in kernel threads is not something that will impede code modifications and refactoring I would have less of a problem, and might not care. With pid namespaces all kernel threads will disappear so how do we cope with the problem when the sysadmin can not see the kernel threads? Eric _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: ebiederm
date: 2007-04-19T19:20:29-00:00

Re: [PATCH] nfs lockd reclaimer: Convert to kthread API
type: item
description: On Thu, 2007-04-19 at 13:20 -0600, Eric W. Biederman wrote: > Trond Myklebust <trond.myklebust@fys.uio.no> writes: > > > On Thu, 2007-04-19 at 01:58 -0600, Eric W. Biederman wrote: > >> From: Eric W. Biederman <ebiederm@xmission.com> > >> > >> Start the reclaimer thread using kthread_run instead > >> of a combination of kernel_thread and daemonize. > >> The small amount of signal handling code is also removed > >> as it makes no sense and is a maintenance problem to handle > >> signals in kernel threads. > > > > Vetoed. Removing stuff just because it doesn't make sense to you is not > > acceptable. > > > > Signal handling in reclaimer threads is there in order to allow > > administrators to deal with the case where the server never comes up > > again. > > Doesn't unmount handle that? On a pinned filesystem? > Regardless kernel threads should be an implementation detail > not a part of the user interface. If kernel threads are part > of the user interface it makes them very hard to change. > > So it isn't that it doesn't make sense to me it is that it looks > fundamentally broken and like a maintenance nightmare. > > I would rather kill kernel threads then try and simulate them > when the kernel implementation has changed and kernel threads > are not visible. > > If I could be convinced that signal handling in kernel threads > is not something that will impede code modifications and refactoring > I would have less of a problem, and might not care. Tough. You're the one proposing to change existing code. > With pid namespaces all kernel threads will disappear so how do > we cope with the problem when the sysadmin can not see the kernel > threads? Then you have a usability problem. How does the sysadmin reboot the system if there is no way to shut down the processes that are hanging on an unresponsive filesystem? Trond _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman…
creator: Trond Myklebust
date: 2007-04-19T21:19:24-00:00

Re: [PATCH] nfs lockd reclaimer: Convert to kthread API
type: item
description: On Thu, 2007-04-19 at 17:19 -0400, Trond Myklebust wrote: > > With pid namespaces all kernel threads will disappear so how do > > we cope with the problem when the sysadmin can not see the kernel > > threads? Do they actually always disappear, or do we keep them in the init_pid_namespace? -- Dave _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: Dave Hansen
date: 2007-04-19T21:25:02-00:00

Re: [PATCH] nfs lockd reclaimer: Convert to kthread API
type: item
description: On Thu, 19 Apr 2007 17:19:24 -0400 Trond Myklebust <trond.myklebust@fys.uio.no> wrote: > > Regardless kernel threads should be an implementation detail > > not a part of the user interface. If kernel threads are part > > of the user interface it makes them very hard to change. > > > > So it isn't that it doesn't make sense to me it is that it looks > > fundamentally broken and like a maintenance nightmare. > > > > I would rather kill kernel threads then try and simulate them > > when the kernel implementation has changed and kernel threads > > are not visible. > > > > If I could be convinced that signal handling in kernel threads > > is not something that will impede code modifications and refactoring > > I would have less of a problem, and might not care. > > Tough. You're the one proposing to change existing code. Using signals to communicate with kernel threads is fairly unpleasant, IMO. We have much simpler, faster and more idiomatic ways of communicating between threads in-kernel and there are better ways in which userspace can communicate with the kernel - system calls, for example... So I think generally any move which gets us away from using signals in kernel threads is moving in a good direction. > > With pid namespaces all kernel threads will disappear so how do > > we cope with the problem when the sysadmin can not see the kernel > > threads? > > Then you have a usability problem. How does the sysadmin reboot the > system if there is no way to shut down the processes that are hanging on > an unresponsive filesystem? Where's the hang? A user process is stuck on h_rwsem? If so, would it be appropriate to convert the user process to use down_foo_interruptible(), so that the operator can just kill the user process as expected, rather than having to futz around killing kernel threads? _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: akpm
date: 2007-04-19T21:40:59-00:00

Re: [PATCH] nfs lockd reclaimer: Convert to kthread API
type: item
description: On Thu, 2007-04-19 at 14:40 -0700, Andrew Morton wrote: > Using signals to communicate with kernel threads is fairly unpleasant, IMO. > We have much simpler, faster and more idiomatic ways of communicating > between threads in-kernel and there are better ways in which userspace can > communicate with the kernel - system calls, for example... > > So I think generally any move which gets us away from using signals in > kernel threads is moving in a good direction. I have yet to see a proposal which did. Eric's patch was eliminating signals in kernel threads that used them without proposing any replacement mechanism or showing that he had plans to do so. That is a good reason for a veto. > > > With pid namespaces all kernel threads will disappear so how do > > > we cope with the problem when the sysadmin can not see the kernel > > > threads? > > > > Then you have a usability problem. How does the sysadmin reboot the > > system if there is no way to shut down the processes that are hanging on > > an unresponsive filesystem? > > Where's the hang? A user process is stuck on h_rwsem? > > If so, would it be appropriate to convert the user process to use > down_foo_interruptible(), so that the operator can just kill the user > process as expected, rather than having to futz around killing kernel > threads? If an NFS server reboots, then the locks held by user processes on the client need to be re-established by when it comes up again. Otherwise, the processes that thought they were holding locks will suddenly fail. This recovery job is currently the done by a kernel thread. The question is then what to do if the server crashes again while the kernel thread is re-establishing the locks. Particularly if it never comes back again. Currently, the administrator can intervene by killing anything that has open files on that volume and kill the recovery kernel thread. You'll also note that lockd_down(), nfsd_down() etc all use signals to inform lockd(), nfsd() etc that they should b…
creator: Trond Myklebust
date: 2007-04-19T22:04:44-00:00

Re: [PATCH] mtd_blkdevs: Convert to use the kthread API
type: item
description: On Thu, 19 Apr 2007 13:13:22 -0600 ebiederm@xmission.com (Eric W. Biederman) wrote: > Christoph Hellwig <hch@infradead.org> writes: > > > On Thu, Apr 19, 2007 at 12:55:28AM -0600, Eric W. Biederman wrote: > >> From: Eric W. Biederman <ebiederm@xmission.com> - unquoted > >> > >> thread_run is used intead of kernel_thread, daemonize, and mucking > >> around blocking signals directly. > > > > Please don't do incomplete transitions like that. We don't really > > want people to use kthread_run, but not the kthread stopping > > mechanisms, because people will simply forget about that bit and > > we'll never get rid of the enormous amount of, erm creativity, in > > handling kernel thread stopping. > > > > This is just the first patch in your series where the thread is mutable, > > but it equally applies to all following patches where this is the case > > aswell. > > I don't really care about the creativity. Although it would > be nice if it wasn't there. I deliberately left it in so I would be > certain my patches were correct. > > I care about killing the maintenance and forward development roadblocks > that are kernel_thread and daemonize. And the user interface problem > that is handling signals in kernel threads. > Yes, I think that is a practical position, if not an ideal one. MTD (to pick one example) does need to be decruftified: remove r->blkcore_priv->exiting, probably ->blkcore_priv->thread_dead, switch deregister_mtd_blktrans() to use kthread_stop(). But it's a bit much to expect Eric to make that conversion, and to suitably test it. All he can do is to make a best-effort and hope that someone else tests it, which isn't very reliable. This partial patch at least gets us some of the way there, and serves as a gentle reminder to dwmwyouknowwho to finish cleaning this stuff up. I'd be more concerned about a part-conversion in a subsystem which has no identifiable maintainer, because in that case the chances are that we'll just forget about it an the conversion woul…
creator: akpm
date: 2007-04-19T22:26:39-00:00

Re: [PATCH] dvb_en_50221: Convert to kthread API
type: item
description: On Thu, 19 Apr 2007 01:59:04 -0600 "Eric W. Biederman" <ebiederm@xmission.com> wrote: > This patch is a minimal transformation to use the kthread API > doing it's best to preserve the existing logic. > > Instead of starting kdvb-ca by calling kernel_thread, > daemonize and sigfillset we kthread_run is used. > > Instead of tracking the pid of the running thread we instead > simply keep a flag to indicate that the current thread is > running, as that is all the pid is really used for. > > And finally the kill_proc sending signal 0 to the kernel thread to > ensure it is alive before we wait for it to shutdown is removed. > The kthread API does not provide the pid so we don't have that > information readily available and the test is just silly. If there > is no shutdown race the test is a useless confirmation of that the > thread is running. If there is a race the test doesn't fix it and > we should fix the race properly. urgh, yes, this is just sad. We should convert this driver fully to the kthread API - it will end up much better. I'll queue this up as a -mm-only thing as a gentle reminder that we should do it properly. _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: akpm
date: 2007-04-19T22:34:13-00:00

Re: [PATCH] smbfs: Remove unnecessary allow_signal
type: item
description: On Thu, 19 Apr 2007 01:59:03 -0600 "Eric W. Biederman" <ebiederm@xmission.com> wrote: > From: Eric W. Biederman <ebiederm@xmission.com> > > Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> > --- > fs/smbfs/smbiod.c | 2 -- > 1 files changed, 0 insertions(+), 2 deletions(-) > > diff --git a/fs/smbfs/smbiod.c b/fs/smbfs/smbiod.c > index 3e61b44..67176af 100644 > --- a/fs/smbfs/smbiod.c > +++ b/fs/smbfs/smbiod.c > @@ -298,8 +298,6 @@ out: > */ > static int smbiod(void *unused) > { > - allow_signal(SIGKILL); > - > VERBOSE("SMB Kernel thread starting (%d) ...\n", current->pid); > Why is it unnecessary? afaict we can presently terminate smbiod with a SIGKILL, and this change will alter (ie: break) that behaviour? _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: akpm
date: 2007-04-19T22:47:42-00:00

Re: [PATCH] saa7134-tvaudio: Convert to kthread API.
type: item
description: On Thu, 19 Apr 2007 01:58:58 -0600 "Eric W. Biederman" <ebiederm@xmission.com> wrote: > It is my goal to replace all kernel code that handles signals > from user space, calls kernel_thread or calls daemonize. All > of which the kthread_api makes unncessary. Handling signals > from user space is a maintenance problem becuase using a > kernel thread is an implementation detail and if user space > cares it does not allow us to change the implementation. Calling > daemonize is a problem because it has to undo a continually changing > set of state generated by user space, requiring the implemetation > to change continually. kernel_thread is a problem because it > returns a pid_t value. Numeric pids are inherently racy and > in the presence of a pid namespace they are no longer global > making them useless for general use in the kernel. > > So this patch renames the pid member of struct saa7134_thread > started and changes it's type from pid_t to int. All it > has ever been used for is to detect if the kernel thread > is has been started so this works. > > allow_signal(SIGTERM) and the calls to signal_pending have > been removed they are needed for the driver to operation. > > The startup of tvaudio_thread and tvaudio_thread_dep have > been modified to use kthread_run instead of a combination > of kernel_thread and daemonize. > > The result is code that is slightly simpler and more > maintainable. This one also really wants to be converted to full use of the API. ie: use kthread_stop(), kthread_should_stop(), remove all the hand-woven equivalent stuff we have in there. I'll tag this as an -mm-only thing as well, in the hope that someone who can test the changes will be able to find time to address all this. _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: akpm
date: 2007-04-19T22:52:45-00:00

Re: [PATCH] ipv4/ipvs: Convert to kthread API
type: item
description: On Thu, 19 Apr 2007 18:04:36 +0900 Simon Horman <horms@verge.net.au> wrote: > On Thu, Apr 19, 2007 at 01:58:57AM -0600, Eric W. Biederman wrote: > > From: Eric W. Biederman <ebiederm@xmission.com> > > > > Modify startup of ipvs sync threads to use kthread_run > > instead of a weird combination of calling kernel_thread > > to start a fork_sync_thread whose hole purpose in life was > > to call kernel_thread again starting the actually sync thread > > which called daemonize. > > > > To use kthread_run I had to move the name calcuation from > > sync_thread into start_sync_thread resulting in a small > > amount of code motion. > > > > The result is simpler and more maintainable piece of code. > > Thanks Eric, I'll review this and get back to you shortly. > There still seems to be quite a lot of complexity in this driver's thread handling which could be removed if we did a full conversion to the kthread API. It all looks.... surprisingly complex in there. _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: akpm
date: 2007-04-19T22:59:44-00:00

Re: [PATCH] net/rxrpc: Convert to kthread API.
type: item
description: On Thu, 19 Apr 2007 10:32:38 +0100 David Howells <dhowells@redhat.com> wrote: > Eric W. Biederman <ebiederm@xmission.com> wrote: > > > This patch modifies the startup of krxtimod, krxiod, and krxsecd > > to use kthread_run instead of a combination of kernel_thread > > and daemonize making the code slightly simpler and more maintainable. > > Again, please drop in favour of my RxRPC patches. > Do those patches convert all this code over to full use of the kthread API? Because it seems that a conversion would be straightforward, and is needed. _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: akpm
date: 2007-04-19T23:05:30-00:00

Re: [PATCH] bluetooth rfcomm: Convert to kthread API.
type: item
description: On Thu, 19 Apr 2007 01:58:54 -0600 "Eric W. Biederman" <ebiederm@xmission.com> wrote: > From: Eric W. Biederman <ebiederm@xmission.com> > > This patch starts krfcommd using kthread_run instead of a combination > of kernel_thread and daemonize making the code slightly simpler > and more maintainable. gargh, the more I look at these things, the more I agree with Christoph. > Cc: Marcel Holtmann <marcel@holtmann.org> > Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> > --- > net/bluetooth/rfcomm/core.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c > index 34f993a..baaad49 100644 > --- a/net/bluetooth/rfcomm/core.c > +++ b/net/bluetooth/rfcomm/core.c > @@ -38,6 +38,7 @@ > #include <linux/net.h> > #include <linux/mutex.h> > #include <linux/freezer.h> > +#include <linux/kthread.h> > > #include <net/sock.h> > #include <asm/uaccess.h> > @@ -1938,7 +1939,6 @@ static int rfcomm_run(void *unused) > > atomic_inc(&running); > > - daemonize("krfcommd"); > set_user_nice(current, -10); > > BT_DBG(""); > @@ -2058,7 +2058,7 @@ static int __init rfcomm_init(void) > > hci_register_cb(&rfcomm_cb); > > - kernel_thread(rfcomm_run, NULL, CLONE_KERNEL); > + kthread_run(rfcomm_run, NULL, "krfcommd"); > > if (class_create_file(bt_class, &class_attr_rfcomm_dlc) < 0) > BT_ERR("Failed to create RFCOMM info file"); We should remove the file-wide `terminate' and `running' and switch the thread management over to kthread_run(), kthread_stop() and kthread_should_stop(). btw, this: static void rfcomm_worker(void) { BT_DBG(""); while (!atomic_read(&terminate)) { try_to_freeze(); if (!test_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event)) { /* No pending events. Let's sleep. * Incoming connections and data will wake us up. */ set_current_state(TASK_INTERRUPTIBLE); schedule(); } /* Process stuff */ clear_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event); rfcomm_process_sessions(); } set_current_state(TASK_RUNNING); return; } a…
creator: akpm
date: 2007-04-19T23:12:53-00:00

Re: [PATCH] bluetooth hidp: Convert to kthread API.
type: item
description: On Thu, 19 Apr 2007 01:58:53 -0600 "Eric W. Biederman" <ebiederm@xmission.com> wrote: > This patch starts up khidp using kthread_run instead > of kernel_thread and daemonize, resulting is slightly > simpler and more maintainable code. argh, they're all like this :( It's a shame your changelogs didn't fully spell out the reasons for this conversion. Right now, the maintainers probably think that these are nice-to-have cleanups, not must-have-to-make-virtualisation-work-right fixes. _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: akpm
date: 2007-04-19T23:20:37-00:00

Re: [PATCH] bluetooth bnep: Convert to kthread API.
type: item
description: On Thu, 19 Apr 2007 01:58:51 -0600 "Eric W. Biederman" <ebiederm@xmission.com> wrote: > From: Eric W. Biederman <ebiederm@xmission.com> > > This patch starts kbenpd using kthread_run replacing > a combination of kernel_thread and daemonize. Making > the code a little simpler and more maintainable. > > while (!atomic_read(&s->killed)) { ho hum. > + task = kthread_run(bnep_session, s, "kbnepd %s", dev->name); It's unusual to have a kernel thread which has a space in its name. That could trip up infufficient-defensive userspace tools. _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: akpm
date: 2007-04-19T23:24:59-00:00