From patchwork Fri Jul 24 13:16:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhaolei X-Patchwork-Id: 6860411 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 684569F38B for ; Fri, 24 Jul 2015 13:18:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9D1EF20412 for ; Fri, 24 Jul 2015 13:18:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C56DB20588 for ; Fri, 24 Jul 2015 13:18:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754555AbbGXNSL (ORCPT ); Fri, 24 Jul 2015 09:18:11 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:19547 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1753133AbbGXNSK (ORCPT ); Fri, 24 Jul 2015 09:18:10 -0400 X-IronPort-AV: E=Sophos;i="5.15,520,1432569600"; d="scan'208";a="98821902" Received: from unknown (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 24 Jul 2015 21:21:45 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id t6ODGHdp028003 for ; Fri, 24 Jul 2015 21:16:17 +0800 Received: from localhost.localdomain (10.167.226.114) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server id 14.3.181.6; Fri, 24 Jul 2015 21:18:06 +0800 From: Zhaolei To: CC: Zhao Lei Subject: [PATCH 2/5] btrfs-progs: Move close timer handle code to line after sub process exit Date: Fri, 24 Jul 2015 21:16:26 +0800 Message-ID: <04b5e2ecb060dd8295f11277f255639d0c1dba34.1437743469.git.zhaolei@cn.fujitsu.com> X-Mailer: git-send-email 1.8.5.1 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Zhao Lei The timer handle have possibility in using by sub thread, better to close it after sub process exit. Signed-off-by: Zhao Lei --- task-utils.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/task-utils.c b/task-utils.c index 0390a69..17fd573 100644 --- a/task-utils.c +++ b/task-utils.c @@ -61,14 +61,14 @@ void task_stop(struct task_info *info) if (!info) return; - if (info->periodic.timer_fd) - close(info->periodic.timer_fd); - if (info->id > 0) { pthread_cancel(info->id); pthread_join(info->id, NULL); } + if (info->periodic.timer_fd) + close(info->periodic.timer_fd); + if (info->postfn) info->postfn(info->private_data); }