From patchwork Thu Mar 22 17:01:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Merzlyakov X-Patchwork-Id: 889478 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ZufoS3pX"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="MwNdQDCP"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 406Xxv04wxz9s1P for ; Fri, 23 Mar 2018 04:01:23 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=j2Y34DWWCEMZAqUfJBeTpSV8BMTVd1Y5rrw2ccS5KC8=; b=ZufoS3pXWcCPWb NBejVfqQ2tqXQCs64j225ur7QEdIz7Fq2reLEwCO9hDywnsCgUeZi/HxsYpjP88UXhwGpo+q5bGtw wmQM/a7CSBI7ifFrkIj6TfQUI353ZAeSS37UdDSVjMLfQau+vZmReQWgQwHLf+r3KDWgPdXd8NC/w 9lDDZXDVoWBEut4p2APXTmYMj9OBH0jpLMJ+OmkRyl2LYNOFMdc9BEFZ2dk7fsIZwy9Rz9IBhXe/k PtPktDdPGXIgYK1LkujfPGl7lUVW4WqeQ0Dj9ZB5Hox5f7+SWrfHongwPgovXxYRARHj4Fhg3P1dg MEL6leB2YisDqSN5RZEw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ez3aR-0003qO-Nt; Thu, 22 Mar 2018 17:01:11 +0000 Received: from mail-pg0-x241.google.com ([2607:f8b0:400e:c05::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ez3aN-0003gW-0x for lede-dev@lists.infradead.org; Thu, 22 Mar 2018 17:01:09 +0000 Received: by mail-pg0-x241.google.com with SMTP id i9so3494181pgq.10 for ; Thu, 22 Mar 2018 10:00:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yoXNeSN1vu2jOSpP7iha7MeNRgfFePWznq5lrXRr4qA=; b=MwNdQDCPyMBl1Scu3CvMxSDkiNZVyyvPP6FMRa9eJweOJ8VTv19idXWff6sjoWwx5D eoEhphSwrc40f1TFsJ+PhKZjDe3inKbF/eZGBBgTdJooiglL17BPw6u11Hlm8wjTI9jp cTQVWEdwqPKajLIQxx/EejkGR3/6TrP+aKnTuR0hFudB9exHzGLimxWyNVcCn5YwqDyS I5WxVkwvUnOh2wZEdsWHxwv0Y8q98CKDHkpt50E1R5L6h5zpj4B6/8yWm//GiynocfZ/ 8i6vyvigt+GYdadFvtGkqbFo//3o0S6PwowJuZZ8uI+/6/vJjeNyZxkJGwg+TPozIeYA uHRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yoXNeSN1vu2jOSpP7iha7MeNRgfFePWznq5lrXRr4qA=; b=ukQMqoAb8M+gDh/XNmvjyeg+frLLC/6LYLWYbccibiEP0wd68upoh1WnsGz9Edzr+t Zfp4ja6EBRBHJyas9bLxkvDiVjkI8WxSA9yuwE3ahjFnTJ6gcipZk6gsSDtGZkZk4N1J u2/zkW6D+BW4Nc8bgt3hSUKIi5q+p0EoDXwiVnz+/kfyoijZaEoEpdTo/aK5xCktkvf5 ujatXgKqMAMbFLButfge8EzR89AqZjWl6yuEMlVT9V9Y+InQAXVgu5sAr6bvxPiQ+knq b5klMTiqgQg2KeUEQjrp2MO1hyvG0OZZTJhISCMpLJFLqM0Er0b5xLFPiGM91EDx6Fkv w+eA== X-Gm-Message-State: AElRT7HMYRV4+t41C89JB2haEZNXjwxKs50eVn19caXsUNdFsqO7kNJf 0Y1KjqtsiPIJzAcKr88WpH/aBCvV X-Google-Smtp-Source: AG47ELsF1VSZFU+c8bbxNH9nEWn5SpQ37/SS0+wowze7segQbKfDOsTWEnjgWCHZDVgKEAlrFldAgA== X-Received: by 10.99.97.149 with SMTP id v143mr18486473pgb.319.1521738054761; Thu, 22 Mar 2018 10:00:54 -0700 (PDT) Received: from well.corp.ubnt.com ([2a02:16d8:105:4000:1d8d:bb15:157e:da21]) by smtp.gmail.com with ESMTPSA id p86sm15190859pfi.55.2018.03.22.10.00.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Mar 2018 10:00:53 -0700 (PDT) From: Pavel Merzlyakov To: lede-dev@lists.infradead.org Date: Thu, 22 Mar 2018 19:01:22 +0200 Message-Id: <20180322170123.22269-2-pavel.merzlyakov@gmail.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180322170123.22269-1-pavel.merzlyakov@gmail.com> References: <20180322170123.22269-1-pavel.merzlyakov@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180322_100107_239242_73C05616 X-CRM114-Status: GOOD ( 10.98 ) X-Spam-Score: -0.1 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2607:f8b0:400e:c05:0:0:0:241 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (pavel.merzlyakov[at]gmail.com) 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Subject: [LEDE-DEV] [PATCH] procd: Fix stop of instance when respawn scheduled X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Pavel Merzlyakov MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org It's give ability to stop respawn of instance which crashes in the beginning Signed-off-by: Pavel Merzlyakov --- service/instance.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/service/instance.c b/service/instance.c index ecbb6ea..e2f0ee3 100644 --- a/service/instance.c +++ b/service/instance.c @@ -511,6 +511,16 @@ instance_timeout(struct uloop_timeout *t) instance_start(in); } +static void +instance_stopped(struct service_instance *in) +{ + struct service *s = in->srv; + + avl_delete(&s->instances.avl, &in->node.avl); + instance_free(in); + service_stopped(s); +} + static void instance_exit(struct uloop_process *p, int ret) { @@ -532,13 +542,8 @@ instance_exit(struct uloop_process *p, int ret) instance_removepid(in); if (in->restart) instance_start(in); - else { - struct service *s = in->srv; - - avl_delete(&s->instances.avl, &in->node.avl); - instance_free(in); - service_stopped(s); - } + else + instance_stopped(in); } else if (in->restart) { instance_start(in); } else if (in->respawn) { @@ -563,7 +568,7 @@ void instance_stop(struct service_instance *in, bool halt) { if (!in->proc.pending) - return; + return instance_stopped(in); in->halt = halt; in->restart = in->respawn = false; kill(in->proc.pid, SIGTERM);