From patchwork Tue Jan 8 13:54:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 1946171 Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by patchwork1.kernel.org (Postfix) with ESMTP id B454A3FC5A for ; Tue, 8 Jan 2013 13:58:49 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r08Dtukp019916; Tue, 8 Jan 2013 08:55:56 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r08DsZqm004726 for ; Tue, 8 Jan 2013 08:54:35 -0500 Received: from mx1.redhat.com (ext-mx12.extmail.prod.ext.phx2.redhat.com [10.5.110.17]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r08DsYsP027217 for ; Tue, 8 Jan 2013 08:54:35 -0500 Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r08DsXKJ010059 for ; Tue, 8 Jan 2013 08:54:33 -0500 Received: from relay2.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id F3F63A522C; Tue, 8 Jan 2013 14:54:29 +0100 (CET) From: Hannes Reinecke To: Christophe Varoqui Date: Tue, 8 Jan 2013 14:54:15 +0100 Message-Id: <1357653259-62650-38-git-send-email-hare@suse.de> In-Reply-To: <1357653259-62650-1-git-send-email-hare@suse.de> References: <1357653259-62650-1-git-send-email-hare@suse.de> X-RedHat-Spam-Score: -7.299 (BAYES_00, DCC_REPUT_00_12, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.17 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com Subject: [dm-devel] [PATCH 38/42] multipathd: Ignore errors when creating pidfile X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com We can use CLI commands to communicate with the daemon, so we don't need the pidfile for correct operation. Hence any errors from creating the pidfile can be safely ignored. Signed-off-by: Hannes Reinecke --- multipathd/main.c | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index 7fe9c5b..6c5e243 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -1560,7 +1560,7 @@ child (void * param) struct vectors * vecs; struct multipath * mpp; int i; - int rc; + int rc, pid_rc; mlockall(MCL_CURRENT | MCL_FUTURE); @@ -1667,9 +1667,8 @@ child (void * param) pthread_mutex_lock(&exit_mutex); /* Startup complete, create logfile */ - if (pidfile_create(DEFAULT_PIDFILE, daemon_pid)) - /* Ignore errors, we can live without */ - condlog(1, "failed to create pidfile"); + pid_rc = pidfile_create(DEFAULT_PIDFILE, daemon_pid); + /* Ignore errors, we can live without */ running_state = DAEMON_RUNNING; pthread_cond_wait(&exit_cond, &exit_mutex); @@ -1715,8 +1714,10 @@ child (void * param) dm_lib_exit(); /* We're done here */ - condlog(3, "unlink pidfile"); - unlink(DEFAULT_PIDFILE); + if (!pid_rc) { + condlog(3, "unlink pidfile"); + unlink(DEFAULT_PIDFILE); + } condlog(2, "--------shut down-------");