From patchwork Thu Jul 14 02:51:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kinglong Mee X-Patchwork-Id: 9228829 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7942060868 for ; Thu, 14 Jul 2016 02:51:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69FA126861 for ; Thu, 14 Jul 2016 02:51:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C7C0280B0; Thu, 14 Jul 2016 02:51:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 099D226861 for ; Thu, 14 Jul 2016 02:51:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751059AbcGNCvb (ORCPT ); Wed, 13 Jul 2016 22:51:31 -0400 Received: from mail-pa0-f67.google.com ([209.85.220.67]:36473 "EHLO mail-pa0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750972AbcGNCva (ORCPT ); Wed, 13 Jul 2016 22:51:30 -0400 Received: by mail-pa0-f67.google.com with SMTP id ez1so498645pab.3 for ; Wed, 13 Jul 2016 19:51:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=to:cc:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=dTEzLaOkVez/nO7s7OkdoqIa+Qx/sFeWkxMbzh7RnMI=; b=GsRR55AuK9RKoGYvA/GqvSUk7Sma1HgR7ovUXQgXpGw+ew+1/uWjm3ENP+yBvxE/m5 0DYE74AqDkDBrFOvb1dSyrqx0cUqdKaW9Gbzi1vNACZtSEPgDfVhmkzsoBcTiWMqaaaF ABv5EuxZATEcsf+OBEwDEv756m9hCo6SXh8CNe7D/zEezKmjBh5KXm0swBjRqcYbFV81 x7Kjv9nv5HPS6g55tL0w88rJnH8ZeEaiDbs9daFhukLsHNwQPo7BFDww9cIunJX6HIY4 rY0cr/YE/43GDB06sTgvQ68gxxGb51LAx4I7SKZ+pR5GexHAudIabsjTAfAldoYt8y4y b0Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:to:cc:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=dTEzLaOkVez/nO7s7OkdoqIa+Qx/sFeWkxMbzh7RnMI=; b=TCQH24020NCJIy05fVsPiR3E6EjLi/vDDXJPMAyBxlfdLcUMcIX6mZY+ug2D45pehw 3k2U7Zd+eTqhaXapMBCzBQW1u+GeimEsL7IksvamjPJ4VsSkGAnDakkGG2d1gwx1tqMq q8bGmwrpvBronzb8Vle29JQ5yMhJz73q6aYQb/wby7wYQPeq/6BPSiQdtKCrvu/9MPFp zLiNbRK9Jn4CU1eBuQsMpAe1Ihk2RS/tPEL58Q8Oh6SM9bzKZpg/t78gl8GRup+W+AjJ bceazVBoNv5ofLYFQ/AVIBLmVqLz3zlt7P5jYX1panZw9UPybTaIwV0m68mYcfCDFc7v WkAw== X-Gm-Message-State: ALyK8tJHWbXBxlFGATRfia8jgfljWVEKTQQt73PRfZii1Vh3S6r3My3cPBoON+rPdxvP8Q== X-Received: by 10.66.65.109 with SMTP id w13mr19249845pas.142.1468464689931; Wed, 13 Jul 2016 19:51:29 -0700 (PDT) Received: from [192.168.99.7] ([191.101.234.188]) by smtp.googlemail.com with ESMTPSA id e4sm6912106pfe.69.2016.07.13.19.51.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jul 2016 19:51:29 -0700 (PDT) To: Steve Dickson Cc: linux-nfs@vger.kernel.org, Kinglong Mee From: Kinglong Mee Subject: [PATCH 2/2] blkmapd: unlink pid file when error out Message-ID: <90d4ca22-1ec0-3cba-263f-7a3cdd871b28@gmail.com> Date: Thu, 14 Jul 2016 10:51:22 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fix some error out without unlink pid file. Signed-off-by: Kinglong Mee --- utils/blkmapd/device-discovery.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/blkmapd/device-discovery.c b/utils/blkmapd/device-discovery.c index 50e2746..8eb3fd0 100644 --- a/utils/blkmapd/device-discovery.c +++ b/utils/blkmapd/device-discovery.c @@ -486,13 +486,13 @@ int main(int argc, char **argv) signal(SIGHUP, SIG_IGN); if (dflag) { - bl_discover_devices(); - exit(0); + ret = bl_discover_devices(); + goto out; } if ((bl_watch_fd = inotify_init()) < 0) { BL_LOG_ERR("init inotify failed %s\n", strerror(errno)); - exit(1); + goto out; } /* open pipe file */ @@ -513,7 +513,7 @@ int main(int argc, char **argv) BL_LOG_ERR("inquiry process return %d\n", ret); } } - +out: if (pidfd >= 0) { close(pidfd); unlink(PID_FILE);