From: Jeff Layton <jlayton@redhat.com>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: Olaf Kirch <okir@suse.de>, Neil Brown <neilb@suse.de>,
Steve Dickson <SteveD@redhat.com>,
Linux NFS Mailing List <linux-nfs@vger.kernel.org>
Subject: Re: nfs-utils: support/nfs/rpcmisc.c
Date: Wed, 28 Jan 2009 11:37:49 -0500 [thread overview]
Message-ID: <20090128113749.7893533a@tleilax.poochiereds.net> (raw)
In-Reply-To: <619E3D97-A202-4F6C-B308-B631F470A8E0@oracle.com>
On Tue, 27 Jan 2009 15:20:02 -0500
Chuck Lever <chuck.lever@oracle.com> wrote:
> Hi all-
>
> I've been stuck on updating the rpc_init() function in support/nfs/
> rpcmisc.c to use TI-RPC functions for a while now. This week I found
> yet another issue, and would like to ask your opinion about how to
> architect a solution.
>
> rpc_init() is used only by rpc.statd and rpc.mountd, to set up their
> RPC listeners. It has logic in it to detect the case where fd 0 is a
> socket being passed in from inetd (I think that's what this does).
>
Weird. That would be my guess too...
> It also has some statics to save the UDP and TCP listener xprt's from
> a previous call, so it doesn't create these again. Specifically for
> rpc.statd, rpc_init() is called only once to set up the UDP and TCP
> listeners, so I don't think those statics would ever be referenced
> after being set during the first call.
>
> Does rpc_init() really need to save the xprts for rpc.statd?
> rpc_init() peeks at xp_port in the returned SVC_XPRT to decide whether
> to use the saved xprt, but TI-RPC's service creation API doesn't fill
> this field in. So this logic won't even work for xprts created with
> TI-RPC calls. I seem to recall seeing some code in libtirpc that
> already checks a list of xprts to prevent the creation of duplicates.
>
It doesn't look like this is necessary for statd. rpc_init looks like
it's only called once from main() before you enter the service loop,
so I don't think statd will ever have the opportunity to create a
duplicate xprt.
> I also notice that rpc_init() uses xlog() to report errors, whereas
> rpc.statd uses note(), and does not initialize the xlog() reporting
> framework. So rpc.statd problems in this area are sporadically
> reported, often without any identifying program name.
>
> And, for rpc.statd, do the listener sockets need to be non-blocking?
> There are four paths in rpc_init() that create listener sockets: one
> is by passing RPC_ANYSOCK to the RPC library; one is using the pre-
> existing fd 0 if it's a socket. The other two are local
> implementations that create a fresh socket, but one sets O_NONBLOCK,
> and the other doesn't. As far as I can tell, O_NONBLOCK support was
> added just for rpc.mountd, but three of these four paths probably do
> not create non-blocking listener sockets. What does rpc.statd need?
>
Not sure on this. My gut feeling says that blocking sockets are OK
for statd given that it's single threaded (right?), but I've not walked
through the code carefully enough to be sure.
> I'm considering creating a version of rpc_init() under utils/statd
> that strips out all of the unnecessary features, uses note() instead
> of xlot(), and then adds support for AF_INET6.
>
Is there some reason to not just convert statd to use xlog()? It
seems like that would be a better long term solution.
For a proof-of-concept sort of thing, that might be reasonable though.
--
Jeff Layton <jlayton@redhat.com>
next prev parent reply other threads:[~2009-01-28 16:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-27 20:20 nfs-utils: support/nfs/rpcmisc.c Chuck Lever
2009-01-28 12:21 ` Steve Dickson
[not found] ` <49804DAC.2000309-AfCzQyP5zfLQT0dZR+AlfA@public.gmane.org>
2009-01-28 17:59 ` Chuck Lever
2009-01-28 16:37 ` Jeff Layton [this message]
[not found] ` <20090128113749.7893533a-RtJpwOs3+0O+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2009-01-28 18:05 ` Chuck Lever
2009-01-28 18:17 ` Jeff Layton
[not found] ` <20090128131707.401de2f1-RtJpwOs3+0O+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2009-01-28 18:19 ` Chuck Lever
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=20090128113749.7893533a@tleilax.poochiereds.net \
--to=jlayton@redhat.com \
--cc=SteveD@redhat.com \
--cc=chuck.lever@oracle.com \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--cc=okir@suse.de \
/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