linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steve Dickson <SteveD@RedHat.com>
To: Scott Mayhew <smayhew@redhat.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [nfs-utils PATCH v3] gssd: daemonize earlier
Date: Thu, 24 Oct 2019 14:05:22 -0400	[thread overview]
Message-ID: <3d4df712-d1e9-e46c-26a2-8ed75e681dc0@RedHat.com> (raw)
In-Reply-To: <20191017150844.21045-1-smayhew@redhat.com>



On 10/17/19 11:08 AM, Scott Mayhew wrote:
> daemon_init() calls closeall() which closes all fd's >= 4.  This causes
> rpc.gssd to fail when it's configured to use the gssproxy interposer
> plugin (via "use-gss-proxy=1" in nfs.conf or GSS_USE_PROXY="yes" in the
> environment) *and* libtirpc debugging is enabled (i.e. at least one
> "-r" on the command line):
> 
> 1. During startup if rpc debugging is enabled then libtirpc_set_debug()
>    is called, which calls openlog() which consumes fd 3.
> 2. If the gssproxy interposer plugin is enabled then when
>    gssd_check_mechs() is called, a socket is created (fd 4) and
>    connected to /var/lib/gssproxy/default.sock.  The fd is stored
>    internally in a struct gpm_ctx.
> 3. daemon_init() runs and closes all fd's >= 4.
> 4. event_init() runs which calls epoll_create() which returns an epoll
>    fd of 4.
> 5. Later when handling an upcall, gssd calls gssd_acquire_krb5_cred()
>    which winds up closing the gpm_ctx->fd which was 4.
> 6. event_dispatch() calls epoll_wait() with epfd=4, and -EBADF is
>    returned.  gssd logs the message ""ERROR: event_dispatch() returned!"
>    and exits.
> 
> The solution is to call daemon_init() earlier.
> 
> Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Committed... 

steved.
> ---
>  utils/gssd/gssd.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/utils/gssd/gssd.c b/utils/gssd/gssd.c
> index 19ad4da..c38dedb 100644
> --- a/utils/gssd/gssd.c
> +++ b/utils/gssd/gssd.c
> @@ -1020,11 +1020,11 @@ main(int argc, char *argv[])
>  			    "support setting debug levels\n");
>  #endif
>  
> +	daemon_init(fg);
> +
>  	if (gssd_check_mechs() != 0)
>  		errx(1, "Problem with gssapi library");
>  
> -	daemon_init(fg);
> -
>  	event_init();
>  
>  	pipefs_dir = opendir(pipefs_path);
> 


      parent reply	other threads:[~2019-10-24 18:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-17 15:08 [nfs-utils PATCH v3] gssd: daemonize earlier Scott Mayhew
2019-10-17 15:26 ` Scott Mayhew
2019-10-24 18:05 ` Steve Dickson [this message]

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=3d4df712-d1e9-e46c-26a2-8ed75e681dc0@RedHat.com \
    --to=steved@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=smayhew@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 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).