提交 363f724c 编写于 作者: C Chuck Lever 提交者: Trond Myklebust

SUNRPC: rpcb_register() should handle errors silently

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=12256Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
上级 cadc0fa5
...@@ -194,7 +194,7 @@ static int rpcb_register_call(const u32 version, struct rpc_message *msg) ...@@ -194,7 +194,7 @@ static int rpcb_register_call(const u32 version, struct rpc_message *msg)
error = PTR_ERR(rpcb_clnt); error = PTR_ERR(rpcb_clnt);
if (error < 0) { if (error < 0) {
printk(KERN_WARNING "RPC: failed to contact local rpcbind " dprintk("RPC: failed to contact local rpcbind "
"server (errno %d).\n", -error); "server (errno %d).\n", -error);
return error; return error;
} }
......
...@@ -818,26 +818,30 @@ static int __svc_rpcb_register6(const u32 program, const u32 version, ...@@ -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 * Returns zero on success; a negative errno value is returned
* if any error occurs. * 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 int family,
const unsigned short protocol, const unsigned short protocol,
const unsigned short port) const unsigned short port)
{ {
int error; int error = -EAFNOSUPPORT;
switch (family) { switch (family) {
case PF_INET: case PF_INET:
return __svc_rpcb_register4(program, version, error = __svc_rpcb_register4(program, version,
protocol, port); protocol, port);
break; break;
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
case PF_INET6: case PF_INET6:
return__svc_rpcb_register6(program, version, error = __svc_rpcb_register6(program, version,
protocol, port); protocol, port);
#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ #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, ...@@ -875,8 +879,8 @@ int svc_register(const struct svc_serv *serv, const int family,
if (progp->pg_vers[i]->vs_hidden) if (progp->pg_vers[i]->vs_hidden)
continue; continue;
error = __svc_register(progp->pg_prog, i, error = __svc_register(progp->pg_name, progp->pg_prog,
family, proto, port); i, family, proto, port);
if (error < 0) if (error < 0)
break; break;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册