From patchwork Wed Oct 24 14:40:37 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 1638771 X-Patchwork-Delegate: alexne@voltaire.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id AA7EDDF2AB for ; Wed, 24 Oct 2012 14:41:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934918Ab2JXOkn (ORCPT ); Wed, 24 Oct 2012 10:40:43 -0400 Received: from jacques.telenet-ops.be ([195.130.132.50]:53838 "EHLO jacques.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935038Ab2JXOkk (ORCPT ); Wed, 24 Oct 2012 10:40:40 -0400 Received: from [192.168.1.101] ([178.119.64.133]) by jacques.telenet-ops.be with bizsmtp id F2ge1k00K2sVyXE0J2geQB; Wed, 24 Oct 2012 16:40:38 +0200 Message-ID: <5087FDE5.30603@acm.org> Date: Wed, 24 Oct 2012 16:40:37 +0200 From: Bart Van Assche User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: Alex Netes CC: "linux-rdma@vger.kernel.org" , Doug Ledford Subject: Re: [PATCH 3/4 for opensm] /etc/init.d/opensmd: Improve systemd integration References: <505C7D44.9060500@acm.org> <20121024132726.GB18591@calypso> In-Reply-To: <20121024132726.GB18591@calypso> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org On 10/24/12 15:27, Alex Netes wrote: > On 16:44 Fri 21 Sep , Bart Van Assche wrote: >> +default_rdma_service=openibd >> +AC_ARG_WITH([rdma_service], >> + AC_HELP_STRING([--with-rdma-service=name], >> + [name of the RDMA service: "rdma" when using /etc/init.d/rdma to start RDMA services; "openibd" when using /etc/init.d/openibd to start RDMA services [default=${default_rdma_service}]])) >> +AC_SUBST(RDMA_SERVICE, ${with_rdma_service:-${default_rdma_service}}) >> + > > There is also an option to run opensm with ibsim. In that case neither rdma > nor openibd should run. Does running opensm with ibsim require to preload libumad2sim ? If so, that's something that's not supported by the current opensm init script, isn't it ? If that is correct then it looks fine to me to make the dependence on the openibd/rdma service explicit in the opensm startup script. >> start () { >> + if [ -e $pidfile ]; then > > On opensm segfault (happens one in a while :), pidfile won't be removed, so > you won't be able to start the opensm again. I guess that same thing can > happen on warm reboot. > >> + echo Already started >> + return 1 >> + fi Good catch. I'll start testing the additional changes below: --- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/scripts/opensm.init.in b/scripts/opensm.init.in index ddd1d6b..c169974 100644 --- a/scripts/opensm.init.in +++ b/scripts/opensm.init.in @@ -68,12 +68,18 @@ if [[ -s $CONFIG ]]; then . $CONFIG fi +running () { + test -e $pidfile && + test "$(readlink "/proc/$(cat $pidfile)/exe")" = "@sbindir@/opensm" +} + start () { - if [ -e $pidfile ]; then + if running; then echo Already started return 1 fi echo -n "Starting opensm: " + rm -f $pidfile @sbindir@/opensm --daemon --pidfile $pidfile $OPTIONS > /dev/null if [[ $RETVAL -eq 0 ]]; then success @@ -124,7 +130,7 @@ case "$1" in restart ;; try-restart | condrestart) - [ -e $pidfile ] && restart + running && restart ;; resweep) killall -HUP opensm