patch-2.1.118 linux/net/sunrpc/sched.c

Next file: linux/net/sunrpc/xprt.c
Previous file: linux/net/sunrpc/clnt.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.117/linux/net/sunrpc/sched.c linux/net/sunrpc/sched.c
@@ -128,7 +128,7 @@
 	if (!timer)
 		timer = __rpc_default_timer;
 	if (expires < jiffies) {
-		printk("RPC: bad timeout value %ld - setting to 10 sec!\n",
+		printk(KERN_ERR "RPC: bad timeout value %ld - setting to 10 sec!\n",
 					task->tk_timeout);
 		expires = jiffies + 10 * HZ;
 	}
@@ -164,7 +164,7 @@
 rpc_make_runnable(struct rpc_task *task)
 {
 	if (task->tk_timeout) {
-		printk("RPC: task w/ running timer in rpc_make_runnable!!\n");
+		printk(KERN_ERR "RPC: task w/ running timer in rpc_make_runnable!!\n");
 		return;
 	}
 	if (RPC_IS_ASYNC(task)) {
@@ -242,7 +242,7 @@
 
 #ifdef RPC_DEBUG
 	if (task->tk_magic != 0xf00baa) {
-		printk("RPC: attempt to wake up non-existing task!\n");
+		printk(KERN_ERR "RPC: attempt to wake up non-existing task!\n");
 		rpc_debug = ~0;
 		return;
 	}
@@ -352,7 +352,6 @@
 /*
  * This is the RPC `scheduler' (or rather, the finite state machine).
  */
-
 static int
 __rpc_execute(struct rpc_task *task)
 {
@@ -363,7 +362,7 @@
 				task->tk_pid, task->tk_flags);
 
 	if (!RPC_IS_RUNNING(task)) {
-		printk("RPC: rpc_execute called for sleeping task!!\n");
+		printk(KERN_WARNING "RPC: rpc_execute called for sleeping task!!\n");
 		return 0;
 	}
 
@@ -413,18 +412,12 @@
 			dprintk("RPC: %4d sync task going to sleep\n",
 							task->tk_pid);
 			if (current->pid == rpciod_pid)
-				printk("RPC: rpciod waiting on sync task!\n");
+				printk(KERN_ERR "RPC: rpciod waiting on sync task!\n");
 			current->timeout = 0;
 			sleep_on(&task->tk_wait);
-			
+
 			/* When the task received a signal, remove from
-			 * any queues etc, and make runnable again.
-			 *
-			 * The "intr" property isnt handled here. rpc_do_call
-			 * has changed the signal mask of the process for
-			 * a synchronous rpc call. If a signal gets through
-			 * this then its real.
-			 */
+			 * any queues etc, and make runnable again. */
 			if (signalled())
 				__rpc_wake_up(task);
 
@@ -467,11 +460,11 @@
 
 	if (incr) {
 		if (rpc_inhibit) {
-			printk("RPC: execution inhibited!\n");
+			printk(KERN_INFO "RPC: execution inhibited!\n");
 			return;
 		}
 		if (executing)
-			printk("RPC: %d tasks executed\n", executing);
+			printk(KERN_WARNING "RPC: %d tasks executed\n", executing);
 	}
 	
 	executing += incr;
@@ -770,6 +763,8 @@
 	rpc_inhibit--;
 }
 
+static struct semaphore rpciod_running = MUTEX_LOCKED;
+
 /*
  * This is the rpciod kernel thread
  */
@@ -786,11 +781,16 @@
 	 * Let our maker know we're running ...
 	 */
 	rpciod_pid = current->pid;
-	wake_up(&rpciod_idle);
+	up(&rpciod_running);
 
 	exit_files(current);
 	exit_mm(current);
+
+	spin_lock_irq(&current->sigmask_lock);
 	siginitsetinv(&current->blocked, sigmask(SIGKILL));
+	recalc_sigpending(current);
+	spin_unlock_irq(&current->sigmask_lock);
+
 	current->session = 1;
 	current->pgrp = 1;
 	sprintf(current->comm, "rpciod");
@@ -798,12 +798,7 @@
 	dprintk("RPC: rpciod starting (pid %d)\n", rpciod_pid);
 	while (rpciod_users) {
 		if (signalled()) {
-			if (sigismember(&current->signal, SIGKILL)) {
-				rpciod_killall();
-			} else {
-				printk("rpciod: ignoring signal (%d users)\n",
-					rpciod_users);
-			}
+			rpciod_killall();
 			flush_signals(current);
 		}
 		__rpc_schedule();
@@ -825,7 +820,7 @@
 
 	dprintk("RPC: rpciod shutdown commences\n");
 	if (all_tasks) {
-		printk("rpciod: active tasks at shutdown?!\n");
+		printk(KERN_ERR "rpciod: active tasks at shutdown?!\n");
 		rpciod_killall();
 	}
 
@@ -847,7 +842,7 @@
 		rpc_killall_tasks(NULL);
 		__rpc_schedule();
 		if (all_tasks) {
-printk("rpciod_killall: waiting for tasks to exit\n");
+			dprintk("rpciod_killall: waiting for tasks to exit\n");
 			current->state = TASK_INTERRUPTIBLE;
 			current->timeout = jiffies + 1;
 			schedule();
@@ -878,16 +873,17 @@
 	 * If there's no pid, we should be the first user.
 	 */
 	if (rpciod_users > 1)
-		printk("rpciod_up: no pid, %d users??\n", rpciod_users);
+		printk(KERN_WARNING "rpciod_up: no pid, %d users??\n", rpciod_users);
 	/*
 	 * Create the rpciod thread and wait for it to start.
 	 */
 	error = kernel_thread(rpciod, &rpciod_killer, 0);
 	if (error < 0) {
-		printk("rpciod_up: create thread failed, error=%d\n", error);
+		printk(KERN_WARNING "rpciod_up: create thread failed, error=%d\n", error);
+		rpciod_users--;
 		goto out;
 	}
-	sleep_on(&rpciod_idle);
+	down(&rpciod_running);
 	error = 0;
 out:
 	up(&rpciod_sema);
@@ -907,10 +903,10 @@
 		if (--rpciod_users)
 			goto out;
 	} else
-		printk("rpciod_down: pid=%d, no users??\n", rpciod_pid);
+		printk(KERN_WARNING "rpciod_down: pid=%d, no users??\n", rpciod_pid);
 
 	if (!rpciod_pid) {
-		printk("rpciod_down: Nothing to do!\n");
+		dprintk("rpciod_down: Nothing to do!\n");
 		goto out;
 	}
 
@@ -928,9 +924,9 @@
 	 * Display a message if we're going to wait longer.
 	 */
 	while (rpciod_pid) {
-		printk("rpciod_down: waiting for pid %d to exit\n", rpciod_pid);
+		dprintk("rpciod_down: waiting for pid %d to exit\n", rpciod_pid);
 		if (signalled()) {
-			printk("rpciod_down: caught signal\n");
+			dprintk("rpciod_down: caught signal\n");
 			break;
 		}
 		interruptible_sleep_on(&rpciod_killer);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov