SUNRPC: The function rpc_restart_call() should return success/failure
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Sat, 31 Jul 2010 18:29:07 +0000 (14:29 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Wed, 4 Aug 2010 02:06:44 +0000 (22:06 -0400)
Both rpc_restart_call_prepare() and rpc_restart_call() test for the
RPC_TASK_KILLED flag, and fail to restart the RPC call if that flag is set.

This patch allows callers to know whether or not the restart was
successful, so that they can perform cleanups etc in case of failure.

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

index 8ed9642a5a766bbec8d6ade82a29b7741f47265c..debe75532199859eceb34c67f1e758568b0e22f3 100644 (file)
@@ -148,8 +148,8 @@ int         rpc_call_sync(struct rpc_clnt *clnt,
                              const struct rpc_message *msg, int flags);
 struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred,
                               int flags);
-void           rpc_restart_call_prepare(struct rpc_task *);
-void           rpc_restart_call(struct rpc_task *);
+int            rpc_restart_call_prepare(struct rpc_task *);
+int            rpc_restart_call(struct rpc_task *);
 void           rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int);
 size_t         rpc_max_payload(struct rpc_clnt *);
 void           rpc_force_rebind(struct rpc_clnt *);
index 756fc324db9ec5dc37870c8f0a2c1e6b2f4d2573..234c40c15f694390b3babaafb4aca1b4bc2aab6a 100644 (file)
@@ -756,12 +756,13 @@ EXPORT_SYMBOL_GPL(rpc_force_rebind);
  * Restart an (async) RPC call from the call_prepare state.
  * Usually called from within the exit handler.
  */
-void
+int
 rpc_restart_call_prepare(struct rpc_task *task)
 {
        if (RPC_ASSASSINATED(task))
-               return;
+               return 0;
        task->tk_action = rpc_prepare_task;
+       return 1;
 }
 EXPORT_SYMBOL_GPL(rpc_restart_call_prepare);
 
@@ -769,13 +770,13 @@ EXPORT_SYMBOL_GPL(rpc_restart_call_prepare);
  * Restart an (async) RPC call. Usually called from within the
  * exit handler.
  */
-void
+int
 rpc_restart_call(struct rpc_task *task)
 {
        if (RPC_ASSASSINATED(task))
-               return;
-
+               return 0;
        task->tk_action = call_start;
+       return 1;
 }
 EXPORT_SYMBOL_GPL(rpc_restart_call);