From patchwork Wed Aug 26 14:03:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhaolei X-Patchwork-Id: 7077741 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 470CBC05AD for ; Wed, 26 Aug 2015 14:39:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6E5B3208DA for ; Wed, 26 Aug 2015 14:39:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8F048208DE for ; Wed, 26 Aug 2015 14:39:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756600AbbHZOFX (ORCPT ); Wed, 26 Aug 2015 10:05:23 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:15597 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1756561AbbHZOFU (ORCPT ); Wed, 26 Aug 2015 10:05:20 -0400 X-IronPort-AV: E=Sophos;i="5.15,520,1432569600"; d="scan'208";a="100045103" Received: from unknown (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 26 Aug 2015 22:08:26 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id t7QE5Ahd026807 for ; Wed, 26 Aug 2015 22:05:10 +0800 Received: from localhost.localdomain (10.167.226.114) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server id 14.3.181.6; Wed, 26 Aug 2015 22:05:16 +0800 From: Zhao Lei To: CC: Zhao Lei Subject: [PATCH 3/4] btrfs-progs: Fix wrong return value of wait_for_subvolume_cleaning() Date: Wed, 26 Aug 2015 22:03:38 +0800 Message-ID: <75136f5acd2273246f1f240505a62de222372084.1440597812.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.3 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 Reproduce: # btrfs subvolume sync /mnt/btrfs Subvolume id 323 is gone # echo $? 1 # Reason: wait_for_subvolume_cleaning() return !0 in right case, because value of ret is set to "is subvolume clean" state before return. Signed-off-by: Zhao Lei --- cmds-subvolume.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmds-subvolume.c b/cmds-subvolume.c index 0d83bd5..0b398f0 100644 --- a/cmds-subvolume.c +++ b/cmds-subvolume.c @@ -66,7 +66,7 @@ static int is_subvolume_cleaned(int fd, u64 subvolid) static int wait_for_subvolume_cleaning(int fd, int count, u64 *ids, int sleep_interval) { - int ret = 0; + int ret; int remaining; int i; @@ -92,6 +92,8 @@ static int wait_for_subvolume_cleaning(int fd, int count, u64 *ids, break; sleep(sleep_interval); } + + ret = 0; out: return ret; }