SUNRPC: Ensure we exit early in case of an encode error
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Thu, 15 May 2008 02:48:25 +0000 (19:48 -0700)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Wed, 9 Jul 2008 16:08:41 +0000 (12:08 -0400)
All errors from call_encode(), with exception of EAGAIN are fatal, so we
should immediately return instead of proceeding to xprt_transmit().

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
net/sunrpc/clnt.c

index 8945307556ec32c1a02da6f505748cb5f813b490..9503b4c177d23a4e3237fe66f1a263fbbb42db0a 100644 (file)
@@ -890,7 +890,6 @@ call_encode(struct rpc_task *task)
                        task->tk_msg.rpc_argp);
        if (task->tk_status == -ENOMEM) {
                /* XXX: Is this sane? */
-               rpc_delay(task, 3*HZ);
                task->tk_status = -EAGAIN;
        }
 }
@@ -1048,8 +1047,14 @@ call_transmit(struct rpc_task *task)
                BUG_ON(task->tk_rqstp->rq_bytes_sent != 0);
                call_encode(task);
                /* Did the encode result in an error condition? */
-               if (task->tk_status != 0)
+               if (task->tk_status != 0) {
+                       /* Was the error nonfatal? */
+                       if (task->tk_status == -EAGAIN)
+                               rpc_delay(task, HZ >> 4);
+                       else
+                               rpc_exit(task, task->tk_status);
                        return;
+               }
        }
        xprt_transmit(task);
        if (task->tk_status < 0)