All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sage Weil <sage@newdream.net>
To: Jim Schutt <jaschut@sandia.gov>
Cc: ceph-devel@vger.kernel.org
Subject: Re: [PATCH] init-ceph: Make sure daemon_is_running() checks the correct instance
Date: Thu, 21 Oct 2010 13:22:07 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.1010211321540.18946@cobra.newdream.net> (raw)
In-Reply-To: <1287678729-14132-1-git-send-email-jaschut@sandia.gov>

Thanks Jim, this will be in v0.22.1.

sage

On Thu, 21 Oct 2010, Jim Schutt wrote:

> When starting multiple instances of a daemon on a single host,
> for unknown reasons /var/run/ceph/$type.$id.pid can hold a pid
> for which /proc/$pid/cmdline identifies the right type of daemon,
> but the wrong instance.  When this happens, all the configured
> instances of a daemon are not running, but repeated invocations
> of "init-ceph start" do not start the missing instances.
> 
> So, check for the correct daemon instance id as well as type when
> testing if the daemon is up.
> 
> Signed-off-by: Jim Schutt <jaschut@sandia.gov>
> ---
>  src/init-ceph.in |    7 ++++---
>  1 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/src/init-ceph.in b/src/init-ceph.in
> index 52891c0..d42a806 100644
> --- a/src/init-ceph.in
> +++ b/src/init-ceph.in
> @@ -69,10 +69,11 @@ signal_daemon() {
>  daemon_is_running() {
>      name=$1
>      daemon=$2
> -    pidfile=$3
> +    daemon_id=$3
> +    pidfile=$4
>      do_cmd "[ -e $pidfile ] || exit 1   # no pid, presumably not running
>  	pid=\`cat $pidfile\`
> -	[ -e /proc/\$pid ] && grep -q $daemon /proc/\$pid/cmdline && exit 0 # running
> +	[ -e /proc/\$pid ] && grep -q $daemon /proc/\$pid/cmdline && grep -qwe -i.$daemon_id /proc/\$pid/cmdline && exit 0 # running
>          exit 1  # pid is something else" "" "okfail"
>  }
>  
> @@ -195,7 +196,7 @@ for name in $what; do
>  
>      # start, and already running?  (do this check early to avoid unnecessary work!)
>      if [ "$command" = "start" ]; then
> -	if daemon_is_running $name c$type $pid_file; then
> +	if daemon_is_running $name c$type $id $pid_file; then
>  	    echo "Starting Ceph $name on $host...already running"
>  	    continue
>  	fi
> -- 
> 1.6.6
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

      reply	other threads:[~2010-10-21 20:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-21 16:32 [PATCH] init-ceph: Make sure daemon_is_running() checks the correct instance Jim Schutt
2010-10-21 20:22 ` Sage Weil [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=Pine.LNX.4.64.1010211321540.18946@cobra.newdream.net \
    --to=sage@newdream.net \
    --cc=ceph-devel@vger.kernel.org \
    --cc=jaschut@sandia.gov \
    /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.