From: Kinglong Mee <kinglongmee@gmail.com>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: "J.,Bruce Fields" <bfields@fieldses.org>,
Gareth Williams <gareth@garethwilliams.me.uk>,
Linux NFS Mailing List <linux-nfs@vger.kernel.org>,
trond.myklebust@primarydata.com
Subject: [PATCH 1/2 v2] SUNRPC/NFSD: Supports new option for ignoring the result of svc_register
Date: Tue, 31 Dec 2013 13:17:20 +0800 [thread overview]
Message-ID: <52C25360.9080207@gmail.com> (raw)
In-Reply-To: <52C2377E.8040006@gmail.com>
Williams reports starting NFSv4 failed without rpcbind, get error,
#rpc.nfsd -N 2 -N 3
rpc.nfsd: writing fd to kernel failed: errno 111 (Connection refused)
rpc.nfsd: unable to set any sockets for nfsd
For this, NFSv4 needs ignoring the result from svc_register,
so adds a flags in svc_version.
v2:
use meaningful name vs_rpcb_optnl insteads vs_ignore_err
move setting nfsd_version4's vs_rpcb_optnl option from old patch [2/2]
Reported-by: Gareth Williams <gareth@garethwilliams.me.uk>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
fs/nfsd/nfs4proc.c | 1 +
include/linux/sunrpc/svc.h | 4 +++-
net/sunrpc/svc.c | 25 +++++++++++++++++--------
3 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 419572f..db3d5b9 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -1881,6 +1881,7 @@ struct svc_version nfsd_version4 = {
.vs_proc = nfsd_procedures4,
.vs_dispatch = nfsd_dispatch,
.vs_xdrsize = NFS4_SVC_XDRSIZE,
+ .vs_rpcb_optnl = 1,
};
/*
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 6eecfc2..10e28d1 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -386,8 +386,10 @@ struct svc_version {
struct svc_procedure * vs_proc; /* per-procedure info */
u32 vs_xdrsize; /* xdrsize needed for this version */
- unsigned int vs_hidden : 1; /* Don't register with portmapper.
+ unsigned int vs_hidden : 1, /* Don't register with portmapper.
* Only used for nfsacl so far. */
+ vs_rpcb_optnl:1;/* Don't care the result of register.
+ * Only used for nfsv4. */
/* Override dispatch function (e.g. when caching replies).
* A return value of 0 means drop the request.
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index e7fbe36..5de6801 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -916,9 +916,6 @@ static int __svc_register(struct net *net, const char *progname,
#endif
}
- if (error < 0)
- printk(KERN_WARNING "svc: failed to register %sv%u RPC "
- "service (errno %d).\n", progname, version, -error);
return error;
}
@@ -937,6 +934,7 @@ int svc_register(const struct svc_serv *serv, struct net *net,
const unsigned short port)
{
struct svc_program *progp;
+ struct svc_version *vers;
unsigned int i;
int error = 0;
@@ -946,7 +944,8 @@ int svc_register(const struct svc_serv *serv, struct net *net,
for (progp = serv->sv_program; progp; progp = progp->pg_next) {
for (i = 0; i < progp->pg_nvers; i++) {
- if (progp->pg_vers[i] == NULL)
+ vers = progp->pg_vers[i];
+ if (vers == NULL)
continue;
dprintk("svc: svc_register(%sv%d, %s, %u, %u)%s\n",
@@ -955,16 +954,26 @@ int svc_register(const struct svc_serv *serv, struct net *net,
proto == IPPROTO_UDP? "udp" : "tcp",
port,
family,
- progp->pg_vers[i]->vs_hidden?
- " (but not telling portmap)" : "");
+ vers->vs_hidden ?
+ " (but not telling portmap)" : "");
- if (progp->pg_vers[i]->vs_hidden)
+ if (vers->vs_hidden)
continue;
error = __svc_register(net, progp->pg_name, progp->pg_prog,
i, family, proto, port);
- if (error < 0)
+
+ if (vers->vs_rpcb_optnl) {
+ error = 0;
+ continue;
+ }
+
+ if (error < 0) {
+ printk(KERN_WARNING "svc: failed to register "
+ "%sv%u RPC service (errno %d).\n",
+ progp->pg_name, i, -error);
break;
+ }
}
}
--
1.8.4.2
next prev parent reply other threads:[~2013-12-31 5:17 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-20 17:10 Question ref Running NFS at V4 Only Gareth Williams
2013-12-23 17:39 ` J. Bruce Fields
2013-12-27 10:17 ` Kinglong Mee
2013-12-27 16:05 ` Chuck Lever
2013-12-27 18:43 ` J.;Bruce Fields
2013-12-27 19:40 ` Chuck Lever
[not found] ` <6E281EC9-49CB-4BDA-BDF3-7A6F4B703156@gmail.com>
2013-12-29 6:39 ` Kinglong Mee
[not found] ` <5D65FDE6-D1AB-442C-BFD8-141AB87FF321@gmail.com>
2013-12-29 9:11 ` Kinglong Mee
2013-12-30 11:22 ` Kinglong Mee
2013-12-30 11:24 ` [PATCH 1/2] SUNRPC: supports ignoring error from svc_register Kinglong Mee
2013-12-30 11:25 ` [PATCH 2/2] NFSD: supports nfsv4 service without rpcbind Kinglong Mee
2013-12-30 17:54 ` Chuck Lever
2013-12-31 3:18 ` Kinglong Mee
2013-12-31 5:17 ` Kinglong Mee [this message]
2013-12-31 5:17 ` [PATCH 2/2 v2] NFSD: Don't start lockd when only NFSv4 is running Kinglong Mee
2014-01-03 23:18 ` J.,Bruce Fields
2014-01-06 3:28 ` NFSD: fix compile warning without CONFIG_NFSD_V3 Kinglong Mee
2014-01-06 18:44 ` J.,Bruce Fields
2013-12-31 19:39 ` [PATCH 1/4] SUNRPC: Ensure xprt_connect_status handles all potential connection errors Trond Myklebust
2013-12-31 19:39 ` [PATCH 2/4] SUNRPC: Handle connect errors ECONNABORTED and EHOSTUNREACH Trond Myklebust
2013-12-31 19:39 ` [PATCH 3/4] SUNRPC: Report connection error values to rpc_tasks on the pending queue Trond Myklebust
2013-12-31 19:39 ` [PATCH 4/4] SUNRPC: Add tracepoint for socket errors Trond Myklebust
2014-01-05 19:54 ` J. Bruce Fields
2014-01-05 20:19 ` Trond Myklebust
2014-01-02 4:52 ` [PATCH 1/4] SUNRPC: Ensure xprt_connect_status handles all potential connection errors Kinglong Mee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52C25360.9080207@gmail.com \
--to=kinglongmee@gmail.com \
--cc=bfields@fieldses.org \
--cc=chuck.lever@oracle.com \
--cc=gareth@garethwilliams.me.uk \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@primarydata.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).