From: Steve Dickson <SteveD@redhat.com>
To: Jeff Layton <jlayton@redhat.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH 2/7] clstated: reattempt the pipe open if it fails on ENOENT
Date: Wed, 14 Dec 2011 10:09:04 -0500 [thread overview]
Message-ID: <4EE8BC10.3010005@RedHat.com> (raw)
In-Reply-To: <1323871032-3191-3-git-send-email-jlayton@redhat.com>
On 12/14/2011 08:57 AM, Jeff Layton wrote:
> Generally, we want this daemon started before nfsd starts. Deal with the
> situation where the pipe hasn't shown up yet.
This can be done with your systemd start up script. Plus I'm not sure its
a good idea to steal cpu cycles waiting for an event that may never happen...
steved.
>
> Signed-off-by: Jeff Layton <jlayton@redhat.com>
> ---
> utils/clstated/clstated.c | 15 +++++++++++----
> 1 files changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/utils/clstated/clstated.c b/utils/clstated/clstated.c
> index 93a2710..aab09a7 100644
> --- a/utils/clstated/clstated.c
> +++ b/utils/clstated/clstated.c
> @@ -75,10 +75,17 @@ usage(char *progname)
> static int
> clstate_pipe_open(struct clstate_client *clnt)
> {
> - clnt->cl_fd = open(pipepath, O_RDWR, 0);
> - if (clnt->cl_fd < 0) {
> - xlog(L_ERROR, "%s: unable to open %s: %m", __func__, pipepath);
> - return clnt->cl_fd;
> + /* loop until the pipe is present or open fails for another reason */
> + for (;;) {
> + clnt->cl_fd = open(pipepath, O_RDWR, 0);
> + if (clnt->cl_fd >= 0) {
> + break;
> + } else if (errno != ENOENT) {
> + xlog(D_GENERAL, "%s: unable to open %s: %m", __func__,
> + pipepath);
> + return clnt->cl_fd;
> + }
> + sleep(1);
> }
>
> event_set(&clnt->cl_event, clnt->cl_fd, EV_READ, clstatecb, clnt);
next prev parent reply other threads:[~2011-12-14 15:09 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-14 13:57 [PATCH 0/7] clstated: add a daemon to track NFSv4 client names on stable storage (RFC) Jeff Layton
2011-12-14 13:57 ` [PATCH 1/7] clstated: add clname tracking daemon stub Jeff Layton
2011-12-14 13:57 ` [PATCH 2/7] clstated: reattempt the pipe open if it fails on ENOENT Jeff Layton
2011-12-14 15:09 ` Steve Dickson [this message]
2011-12-14 15:19 ` Jeff Layton
2011-12-14 15:29 ` Steve Dickson
2011-12-14 15:37 ` Jeff Layton
2011-12-14 15:56 ` Steve Dickson
2011-12-14 16:00 ` Jeff Layton
2011-12-14 16:28 ` Steve Dickson
2011-12-14 21:10 ` J. Bruce Fields
2011-12-14 21:20 ` Jeff Layton
2011-12-14 13:57 ` [PATCH 3/7] clstated: add autoconf goop for sqlite Jeff Layton
2011-12-14 13:57 ` [PATCH 4/7] clstated: add routines for a sqlite backend database Jeff Layton
2011-12-14 14:56 ` Chuck Lever
2011-12-14 15:14 ` Jeff Layton
2011-12-14 15:47 ` Chuck Lever
2011-12-14 16:15 ` Jeff Layton
2011-12-15 14:55 ` Chuck Lever
2011-12-15 15:04 ` Jeff Layton
2011-12-14 13:57 ` [PATCH 5/7] clstated: add remove functionality Jeff Layton
2011-12-14 13:57 ` [PATCH 6/7] clstated: add check/update functionality Jeff Layton
2011-12-14 13:57 ` [PATCH 7/7] clstated: add function to remove unreclaimed client records Jeff Layton
2011-12-14 15:23 ` [PATCH 0/7] clstated: add a daemon to track NFSv4 client names on stable storage (RFC) Steve Dickson
2011-12-14 15:32 ` Jeff Layton
2011-12-14 15:44 ` Steve Dickson
2011-12-14 16:05 ` Jeff Layton
2011-12-14 16:26 ` Steve Dickson
2011-12-14 16:34 ` Jeff Layton
2011-12-14 20:31 ` Steve Dickson
2011-12-14 21:06 ` Jeff Layton
2011-12-14 22:27 ` Steve Dickson
2011-12-15 1:46 ` Jeff Layton
2011-12-15 23:34 ` 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=4EE8BC10.3010005@RedHat.com \
--to=steved@redhat.com \
--cc=jlayton@redhat.com \
--cc=linux-nfs@vger.kernel.org \
/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.