diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2009-03-18 20:47:44 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-03-28 15:59:48 -0400 |
commit | 363f724cdd3d2ae554e261be995abdeb15f7bdd9 (patch) | |
tree | 2a1e46fc7f6f78c008d71415c010f555a404922a /net/sunrpc/svc.c | |
parent | cadc0fa534e51e20fdffe1623913c163a18d71b1 (diff) |
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=12256
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/svc.c')
-rw-r--r-- | net/sunrpc/svc.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index 142f64745fba..8ba654bdd608 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c | |||
@@ -818,26 +818,30 @@ static int __svc_rpcb_register6(const u32 program, const u32 version, | |||
818 | * Returns zero on success; a negative errno value is returned | 818 | * Returns zero on success; a negative errno value is returned |
819 | * if any error occurs. | 819 | * if any error occurs. |
820 | */ | 820 | */ |
821 | static int __svc_register(const u32 program, const u32 version, | 821 | static int __svc_register(const char *progname, |
822 | const u32 program, const u32 version, | ||
822 | const int family, | 823 | const int family, |
823 | const unsigned short protocol, | 824 | const unsigned short protocol, |
824 | const unsigned short port) | 825 | const unsigned short port) |
825 | { | 826 | { |
826 | int error; | 827 | int error = -EAFNOSUPPORT; |
827 | 828 | ||
828 | switch (family) { | 829 | switch (family) { |
829 | case PF_INET: | 830 | case PF_INET: |
830 | return __svc_rpcb_register4(program, version, | 831 | error = __svc_rpcb_register4(program, version, |
831 | protocol, port); | 832 | protocol, port); |
832 | break; | 833 | break; |
833 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 834 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
834 | case PF_INET6: | 835 | case PF_INET6: |
835 | return__svc_rpcb_register6(program, version, | 836 | error = __svc_rpcb_register6(program, version, |
836 | protocol, port); | 837 | protocol, port); |
837 | #endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ | 838 | #endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ |
838 | } | 839 | } |
839 | 840 | ||
840 | return -EAFNOSUPPORT; | 841 | if (error < 0) |
842 | printk(KERN_WARNING "svc: failed to register %sv%u RPC " | ||
843 | "service (errno %d).\n", progname, version, -error); | ||
844 | return error; | ||
841 | } | 845 | } |
842 | 846 | ||
843 | /** | 847 | /** |
@@ -875,8 +879,8 @@ int svc_register(const struct svc_serv *serv, const int family, | |||
875 | if (progp->pg_vers[i]->vs_hidden) | 879 | if (progp->pg_vers[i]->vs_hidden) |
876 | continue; | 880 | continue; |
877 | 881 | ||
878 | error = __svc_register(progp->pg_prog, i, | 882 | error = __svc_register(progp->pg_name, progp->pg_prog, |
879 | family, proto, port); | 883 | i, family, proto, port); |
880 | if (error < 0) | 884 | if (error < 0) |
881 | break; | 885 | break; |
882 | } | 886 | } |