From patchwork Tue Dec 19 19:09:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honggang LI X-Patchwork-Id: 10123971 X-Patchwork-Delegate: leon@leon.nu 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 CEBAC603B5 for ; Tue, 19 Dec 2017 19:10:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C36AB29525 for ; Tue, 19 Dec 2017 19:10:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B65102953C; Tue, 19 Dec 2017 19:10:03 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 193992953A for ; Tue, 19 Dec 2017 19:10:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750825AbdLSTKC (ORCPT ); Tue, 19 Dec 2017 14:10:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56182 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750798AbdLSTKB (ORCPT ); Tue, 19 Dec 2017 14:10:01 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 708C37D0F9; Tue, 19 Dec 2017 19:10:01 +0000 (UTC) Received: from dhcp-13-42.nay.redhat.com (unknown [10.66.128.195]) by smtp.corp.redhat.com (Postfix) with ESMTP id CF1A019646; Tue, 19 Dec 2017 19:09:59 +0000 (UTC) From: Honggang LI To: linux-rdma@vger.kernel.org Cc: honli@redhat.com, Bart.VanAssche@wdc.com, jgg@ziepe.ca Subject: [rdma-core PATCH] srp_daemon: Don't create async_ev_thread if only run once Date: Wed, 20 Dec 2017 03:09:58 +0800 Message-Id: <20171219190958.3189-1-honli@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 19 Dec 2017 19:10:01 +0000 (UTC) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Honggang Li fd3005f0cd34 moves the signal handler setup from ibsrpdm path. So, default signal handler will be used when the main pthread send signal SIGINT to pthread async_ev_thread. ibsrpdm will exit with non-zero exit code as default signal handler killed it. ibsrpdm should return with exit code zero, if no error emerged. We should not create async_ev_thread for ibsrpdm. Fixes: fd3005f0cd34 ("srp_daemon: Move the setup of the wakeup_pipe after openlog") Reviewed-by: Bart Van Assche Signed-off-by: Honggang Li Reviewed-by: Nicolas Morey-Chaisemartin --- srp_daemon/srp_daemon.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/srp_daemon/srp_daemon.c b/srp_daemon/srp_daemon.c index cec36db2..4012a7db 100644 --- a/srp_daemon/srp_daemon.c +++ b/srp_daemon/srp_daemon.c @@ -1945,12 +1945,12 @@ static struct resources *alloc_res(void) run_thread_get_trap_notices, &res->res); if (ret) goto err; - } - ret = pthread_create(&res->res.async_ev_thread, NULL, - run_thread_listen_to_events, &res->res); - if (ret) - goto err; + ret = pthread_create(&res->res.async_ev_thread, NULL, + run_thread_listen_to_events, &res->res); + if (ret) + goto err; + } if (config->retry_timeout && !config->once) { ret = pthread_create(&res->res.reconnect_thread, NULL,