]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
SUNRPC: rpcb_register() should handle errors silently
authorChuck Lever <chuck.lever@oracle.com>
Thu, 19 Mar 2009 00:47:44 +0000 (20:47 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Sat, 28 Mar 2009 19:59:48 +0000 (15:59 -0400)
Move error reporting for RPC registration to rpcb_register's caller.

This way the caller can choose to recover silently from certain
errors, but report errors it does not recognize.  Error reporting
for kernel RPC service registration is now handled in one place.

This patch is part of a series that addresses
   http://bugzilla.kernel.org/show_bug.cgi?id=12256

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
net/sunrpc/rpcb_clnt.c
net/sunrpc/svc.c

index 8ea8907d4b8d96b1aa9bf4e23549e6268d57c24f..beee6da330358cb75ef2e7cb22037d635d0080f0 100644 (file)
@@ -194,7 +194,7 @@ static int rpcb_register_call(const u32 version, struct rpc_message *msg)
                error = PTR_ERR(rpcb_clnt);
 
        if (error < 0) {
-               printk(KERN_WARNING "RPC: failed to contact local rpcbind "
+               dprintk("RPC:       failed to contact local rpcbind "
                                "server (errno %d).\n", -error);
                return error;
        }
index 142f64745fba7bbf058b5206112f3dc94087aea3..8ba654bdd6081c376a887955848893bb6ad5945c 100644 (file)
@@ -818,26 +818,30 @@ static int __svc_rpcb_register6(const u32 program, const u32 version,
  * Returns zero on success; a negative errno value is returned
  * if any error occurs.
  */
-static int __svc_register(const u32 program, const u32 version,
+static int __svc_register(const char *progname,
+                         const u32 program, const u32 version,
                          const int family,
                          const unsigned short protocol,
                          const unsigned short port)
 {
-       int error;
+       int error = -EAFNOSUPPORT;
 
        switch (family) {
        case PF_INET:
-               return __svc_rpcb_register4(program, version,
+               error = __svc_rpcb_register4(program, version,
                                                protocol, port);
                break;
 #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
        case PF_INET6:
-               return__svc_rpcb_register6(program, version,
+               error = __svc_rpcb_register6(program, version,
                                                protocol, port);
 #endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
        }
 
-       return -EAFNOSUPPORT;
+       if (error < 0)
+               printk(KERN_WARNING "svc: failed to register %sv%u RPC "
+                       "service (errno %d).\n", progname, version, -error);
+       return error;
 }
 
 /**
@@ -875,8 +879,8 @@ int svc_register(const struct svc_serv *serv, const int family,
                        if (progp->pg_vers[i]->vs_hidden)
                                continue;
 
-                       error = __svc_register(progp->pg_prog, i,
-                                               family, proto, port);
+                       error = __svc_register(progp->pg_name, progp->pg_prog,
+                                               i, family, proto, port);
                        if (error < 0)
                                break;
                }