All of lore.kernel.org
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Simo Sorce <simo@redhat.com>
Cc: Jeff Layton <jlayton@redhat.com>,
	linux-nfs@vger.kernel.org, neilb@suse.de
Subject: Re: [RFC PATCH 1/5] sunrpc: don't wait for write before allowing reads from use-gss-proxy file
Date: Fri, 3 Jan 2014 11:23:19 -0500	[thread overview]
Message-ID: <20140103162319.GK28219@fieldses.org> (raw)
In-Reply-To: <1388736843.26102.33.camel@willson.li.ssimo.org>

On Fri, Jan 03, 2014 at 03:14:03AM -0500, Simo Sorce wrote:
> On Thu, 2014-01-02 at 18:27 -0500, Jeff Layton wrote:
> > On Thu, 2 Jan 2014 17:40:10 -0500
> > "J. Bruce Fields" <bfields@fieldses.org> wrote:
> > 
> > > On Thu, Jan 02, 2014 at 05:26:51PM -0500, Jeff Layton wrote:
> > > > On Thu, 2 Jan 2014 16:21:50 -0500
> > > > "J. Bruce Fields" <bfields@fieldses.org> wrote:
> > > > 
> > > > > On Wed, Jan 01, 2014 at 07:28:30AM -0500, Jeff Layton wrote:
> > > > > > It doesn't make much sense to make reads from this procfile hang. As
> > > > > > far as I can tell, only gssproxy itself will open this file and it
> > > > > > never reads from it. Change it to just give the present setting of
> > > > > > sn->use_gss_proxy without waiting for anything.
> > > > > 
> > > > > I think my *only* reason for doing this was to give a simple way to wait
> > > > > for gss-proxy to start (just wait for a read to return).
> > > > > 
> > > > 
> > > > What wasn't clear to me is what would be doing this read.
> > > > 
> > > > I'll take it from your comment then that patch #1 is acceptable?
> > > 
> > > Yes.  Thanks!
> > > 
> > > > > As long as gss-proxy has some way to say "I'm up and running", and as
> > > > > long as that comes after writing to use-gss-proxy, we're fine.
> > > > > 
> > > > 
> > > > I'll let Simo confirm that that's what gssproxy does, but yes that is
> > > > the desired behavior. Typically this is done by ensuring that the parent
> > > > process when daemon()-izing doesn't exit until everything is ready.
> > > > 
> > > > If gssproxy does need to be changed for that, we have a library routine
> > > > now in nfs-utils that does this that you can likely copy (see
> > > > mydaemon()).
> > > 
> > > From a quick skim: looks like gss-proxy does this in init_server().  So
> > > I think it might need something like the below?
> > > 
> > > (Untested.  I spent a total of maybe five minutes looking at this code
> > > so have no idea what I'm doing.)
> > > 
> > > --b.
> > > 
> > > diff --git a/proxy/src/gssproxy.c b/proxy/src/gssproxy.c
> > > index 1fca922..a7cbd7c 100644
> > > --- a/proxy/src/gssproxy.c
> > > +++ b/proxy/src/gssproxy.c
> > > @@ -97,6 +97,12 @@ int main(int argc, const char *argv[])
> > >          exit(EXIT_FAILURE);
> > >      }
> > >  
> > > +    /*
> > > +     * special call to tell the Linux kernel gss-proxy is available.
> > > +     * Note this must be done before nfsd is started.
> > > +     */
> > > +    init_proc_nfsd(gpctx->config);
> > > +
> > >      init_server(gpctx->config->daemonize);
> > >  
> > >      write_pid();
> > > @@ -139,9 +145,6 @@ int main(int argc, const char *argv[])
> > >          }
> > >      }
> > >  
> > > -    /* special call to tell the Linux kernel gss-proxy is available */
> > > -    init_proc_nfsd(gpctx->config);
> > > -
> > >      ret = gp_workers_init(gpctx);
> > >      if (ret) {
> > >          exit(EXIT_FAILURE);
> > 
> > That doesn't look quite right to me. That has it calling init_proc_nfsd
> > before any of the unix sockets are set up.
> > 
> > I think gss-proxy will probably need to do something similar to what
> > mydaemon does; set up a pipe, and have the parent just block reading
> > from it until the child writes to it. At that point the parent can exit
> > and the pipe can be closed in the child.
> > 
> > See:
> > 
> >     http://git.linux-nfs.org/?p=steved/nfs-utils.git;a=blob;f=support/nfs/mydaemon.c;h=e885d60f3a808299730a4d62dec49142fdc3ba5f;hb=HEAD
> > 
> 
> I'll take a look tomorrow, I created upstream ticket #114 to track this.

Thanks!

I notice there's also sd_notify(3) which avoids the double-fork and
self-pipe, but you might consider that too much of a systemd dependency.

--b.

  reply	other threads:[~2014-01-03 16:23 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-01 12:28 [RFC PATCH 0/5] sunrpc: change handling of use-gss-proxy file Jeff Layton
2014-01-01 12:28 ` [RFC PATCH 1/5] sunrpc: don't wait for write before allowing reads from " Jeff Layton
2014-01-02 21:21   ` J. Bruce Fields
2014-01-02 22:26     ` Jeff Layton
2014-01-02 22:40       ` J. Bruce Fields
2014-01-02 23:27         ` Jeff Layton
2014-01-03  8:14           ` Simo Sorce
2014-01-03 16:23             ` J. Bruce Fields [this message]
2014-01-03 22:06               ` Simo Sorce
2014-01-03 22:34                 ` J. Bruce Fields
2014-01-04 15:28                   ` Simo Sorce
2014-01-04 16:10                     ` J. Bruce Fields
2014-01-04 14:18                 ` Jeff Layton
2014-01-05 22:37     ` NeilBrown
2014-01-05 22:54       ` J. Bruce Fields
2014-01-05 23:30         ` NeilBrown
2014-01-05 23:38           ` Chuck Lever
2014-01-06  1:45       ` Jeff Layton
2014-01-06  6:36         ` Simo Sorce
2014-01-06 15:04           ` J. Bruce Fields
2014-01-06 15:23             ` Simo Sorce
2014-01-01 12:28 ` [RFC PATCH 2/5] sunrpc: don't hang indefinitely in wait_for_gss_proxy Jeff Layton
2014-01-01 12:28 ` [RFC PATCH 3/5] sunrpc: wait for gssproxy to start on initial upcall attempt before falling back to legacy upcall Jeff Layton
2014-01-02 21:35   ` J. Bruce Fields
2014-01-02 23:10     ` Jeff Layton
2014-01-03 16:33       ` J. Bruce Fields
2014-01-03 17:03         ` Jeff Layton
2014-01-01 12:28 ` [RFC PATCH 4/5] sunrpc: fix potential race between setting use_gss_proxy and the upcall rpc_clnt Jeff Layton
2014-01-01 12:28 ` [RFC PATCH 5/5] sunrpc: allow gssproxy to be explicitly disabled from userland Jeff Layton
2014-01-01 19:53 ` [RFC PATCH 0/5] sunrpc: change handling of use-gss-proxy file Simo Sorce

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=20140103162319.GK28219@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=jlayton@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=simo@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.