Commit 363f724cdd3d2ae554e261be995abdeb15f7bdd9
Committed by
Trond Myklebust
1 parent
cadc0fa534
Exists in
master
and in
39 other branches
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>
Showing 2 changed files with 12 additions and 8 deletions Side-by-side Diff
net/sunrpc/rpcb_clnt.c
net/sunrpc/svc.c
... | ... | @@ -818,26 +818,30 @@ |
818 | 818 | * Returns zero on success; a negative errno value is returned |
819 | 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 | 823 | const int family, |
823 | 824 | const unsigned short protocol, |
824 | 825 | const unsigned short port) |
825 | 826 | { |
826 | - int error; | |
827 | + int error = -EAFNOSUPPORT; | |
827 | 828 | |
828 | 829 | switch (family) { |
829 | 830 | case PF_INET: |
830 | - return __svc_rpcb_register4(program, version, | |
831 | + error = __svc_rpcb_register4(program, version, | |
831 | 832 | protocol, port); |
832 | 833 | break; |
833 | 834 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
834 | 835 | case PF_INET6: |
835 | - return__svc_rpcb_register6(program, version, | |
836 | + error = __svc_rpcb_register6(program, version, | |
836 | 837 | protocol, port); |
837 | 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 @@ |
875 | 879 | if (progp->pg_vers[i]->vs_hidden) |
876 | 880 | continue; |
877 | 881 | |
878 | - error = __svc_register(progp->pg_prog, i, | |
879 | - family, proto, port); | |
882 | + error = __svc_register(progp->pg_name, progp->pg_prog, | |
883 | + i, family, proto, port); | |
880 | 884 | if (error < 0) |
881 | 885 | break; |
882 | 886 | } |