Linux NFS development
 help / color / mirror / Atom feed
From: Jeff Layton <jeff.layton@primarydata.com>
To: Steve Dickson <steved@redhat.com>
Cc: Linux NFS Mailing list <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH] gssd: Error out when rpc_pipefs directory is empty
Date: Wed, 9 Jul 2014 06:32:00 -0400	[thread overview]
Message-ID: <20140709063200.6add2dce@tlielax.poochiereds.net> (raw)
In-Reply-To: <1404830019-4299-1-git-send-email-steved@redhat.com>

On Tue,  8 Jul 2014 10:33:39 -0400
Steve Dickson <steved@redhat.com> wrote:

> When there is no kernel modules loaded the rpc_pipefs
> directory is empty, which cause rpc.gssd to silently
> exit.
> 
> This patch adds a check to see if the topdirs_list
> is empty. If so error out without dropping a core.
> 
> Signed-off-by: Steve Dickson <steved@redhat.com>
> ---
>  utils/gssd/gssd_main_loop.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/utils/gssd/gssd_main_loop.c b/utils/gssd/gssd_main_loop.c
> index 9970028..6946ab6 100644
> --- a/utils/gssd/gssd_main_loop.c
> +++ b/utils/gssd/gssd_main_loop.c
> @@ -173,6 +173,10 @@ topdirs_init_list(void)
>  		if (ret)
>  			goto out_err;
>  	}
> +	if (TAILQ_EMPTY(&topdirs_list)) {
> +		printerr(0, "ERROR: rpc_pipefs directory '%s' is empty!\n", pipefs_dir);
> +		return -1;
> +	}
>  	closedir(pipedir);
>  	return 0;
>  out_err:
> @@ -233,9 +237,10 @@ gssd_run()
>  	sigaddset(&set, DNOTIFY_SIGNAL);
>  	sigprocmask(SIG_UNBLOCK, &set, NULL);
>  
> -	if (topdirs_init_list() != 0)
> -		return;
> -
> +	if (topdirs_init_list() != 0) {
> +		/* Error msg is already printed */
> +		exit(1);
> +	}
>  	init_client_list();
>  
>  	printerr(1, "beginning poll\n");

Does it drop a core now? It looks sort of like it would just exit(1)
silently.

In any case, this patch is certainly better than crashing, but gssd
looks sort of like it's doing the wrong thing here. Should it not just
wait idly for directories to show up instead of exiting if none are
present?

Also, because topdir_init_list is run only once, it looks like gssd
doesn't properly handle the case where there may be some directories in
rpc_pipefs when gssd starts, but then others show up later. Any that
show up after gssd is started are just ignored currently, right? That
seems like a subtle source of bugs if you just happen to start gssd a
little early.

-- 
Jeff Layton <jlayton@primarydata.com>

  reply	other threads:[~2014-07-09 10:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-08 14:33 [PATCH] gssd: Error out when rpc_pipefs directory is empty Steve Dickson
2014-07-09 10:32 ` Jeff Layton [this message]
2014-07-09 18:21   ` Steve Dickson
2014-07-09 18:41     ` Jeff Layton
2014-07-09 19:07       ` Steve Dickson
2014-07-09 19:11 ` Steve Dickson

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=20140709063200.6add2dce@tlielax.poochiereds.net \
    --to=jeff.layton@primarydata.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=steved@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