patch-2.2.0-pre2 linux/net/sunrpc/sched.c

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

diff -u --recursive --new-file v2.2.0-pre1/linux/net/sunrpc/sched.c linux/net/sunrpc/sched.c
@@ -79,13 +79,16 @@
  * improve overall performance.
  * Everyone else gets appended to the queue to ensure proper FIFO behavior.
  */
-void
+int
 rpc_add_wait_queue(struct rpc_wait_queue *queue, struct rpc_task *task)
 {
 	if (task->tk_rpcwait) {
 		if (task->tk_rpcwait != queue)
+		{
 			printk(KERN_WARNING "RPC: doubly enqueued task!\n");
-		return;
+			return -EWOULDBLOCK;
+		}
+		return 0;
 	}
 	if (RPC_IS_SWAPPER(task))
 		rpc_insert_list(&queue->task, task);
@@ -95,6 +98,8 @@
 
 	dprintk("RPC: %4d added to queue %p \"%s\"\n",
 				task->tk_pid, queue, rpc_qname(queue));
+
+	return 0;
 }
 
 /*
@@ -168,7 +173,13 @@
 		return;
 	}
 	if (RPC_IS_ASYNC(task)) {
-		rpc_add_wait_queue(&schedq, task);
+		int status;
+		status = rpc_add_wait_queue(&schedq, task);
+		if (status)
+		{
+			printk(KERN_WARNING "RPC: failed to add task to queue: error: %d!\n", status);
+			task->tk_status = status;
+		}
 		wake_up(&rpciod_idle);
 	} else {
 		wake_up(&task->tk_wait);
@@ -202,6 +213,7 @@
 			rpc_action action, rpc_action timer)
 {
 	unsigned long	oldflags;
+	int status;
 
 	dprintk("RPC: %4d sleep_on(queue \"%s\" time %ld)\n", task->tk_pid,
 				rpc_qname(q), jiffies);
@@ -211,11 +223,20 @@
 	 */
 	save_flags(oldflags); cli();
 
-	rpc_add_wait_queue(q, task);
-	task->tk_callback = action;
-	if (task->tk_timeout)
-		rpc_add_timer(task, timer);
-	task->tk_flags &= ~RPC_TASK_RUNNING;
+	status = rpc_add_wait_queue(q, task);
+	if (status)
+	{
+		printk(KERN_WARNING "RPC: failed to add task to queue: error: %d!\n", status);
+		task->tk_status = status;
+		task->tk_flags |= RPC_TASK_RUNNING;
+	}
+	else
+	{
+		task->tk_callback = action;
+		if (task->tk_timeout)
+			rpc_add_timer(task, timer);
+		task->tk_flags &= ~RPC_TASK_RUNNING;
+	}
 
 	restore_flags(oldflags);
 	return;

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