From patchwork Mon Oct 19 11:37:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eryu Guan X-Patchwork-Id: 7435161 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 A87319F36A for ; Mon, 19 Oct 2015 11:40:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DDB3020739 for ; Mon, 19 Oct 2015 11:40:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1933E206FB for ; Mon, 19 Oct 2015 11:40:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751401AbbJSLkQ (ORCPT ); Mon, 19 Oct 2015 07:40:16 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:34579 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750885AbbJSLkP (ORCPT ); Mon, 19 Oct 2015 07:40:15 -0400 Received: by padhk11 with SMTP id hk11so28103911pad.1 for ; Mon, 19 Oct 2015 04:40:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=JBdgTurVdsIGOMe64w9bMmN9qDrKX2BbvJ1pu/qvcmA=; b=KGgblw7Uq+396PW2QG8QqiSt1wDV3yMkC826mKu08sm/t3tRjvpA7Tz7dj3bn3sv9W aEQE0qZeSJkAekorL4j+L4gN3jXrBs2kJJaEN4HIy2zHfN/nVhYEtDZruzein75bU8MI jbGw57ZaMNrKn/KHStgO5vE1eiMtQlBWvb91Y8ByZTxiN+tUqfds/9Pbh4HXIbOH4huG Y3GfVZL8jLmsAMxzYMT1QNIseXKpqzGxcV2Sem33qY5+ElyQ2BSc2g6awLqpfBWRExxU dD+dlfUnIO9QX1Z540GtY8SrYRxyI2YEYYsjkdaTrhNnLWVTPJoBzTrsR7UIO9CORjtv W9Rw== X-Received: by 10.68.222.163 with SMTP id qn3mr34496406pbc.54.1445254815014; Mon, 19 Oct 2015 04:40:15 -0700 (PDT) Received: from localhost ([128.199.137.77]) by smtp.gmail.com with ESMTPSA id uc1sm36249304pab.20.2015.10.19.04.40.13 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Oct 2015 04:40:14 -0700 (PDT) From: Eryu Guan To: linux-btrfs@vger.kernel.org Cc: Eryu Guan Subject: [PATCH 02/10] btrfs-progs: save and return error number correctly in check_chunks_and_extents Date: Mon, 19 Oct 2015 19:37:51 +0800 Message-Id: <1445254680-11102-2-git-send-email-guaneryu@gmail.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1445254680-11102-1-git-send-email-guaneryu@gmail.com> References: <1445254680-11102-1-git-send-email-guaneryu@gmail.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 "err" is assigned to "ret" then "ret" gets overwritten by check_extent_refs() before "ret" can be used. Signed-off-by: Eryu Guan --- cmds-check.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/cmds-check.c b/cmds-check.c index 4225b21..80a7c29 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -8066,13 +8066,12 @@ again: goto out; } - err = check_chunks(&chunk_cache, &block_group_cache, + ret = check_chunks(&chunk_cache, &block_group_cache, &dev_extent_cache, NULL, NULL, NULL, 0); - if (err) { - if (err == -EAGAIN) + if (ret) { + if (ret == -EAGAIN) goto loop; - if (!ret) - ret = err; + err = ret; } ret = check_extent_refs(root, &extent_cache); @@ -8082,8 +8081,8 @@ again: goto out; } - err = check_devices(&dev_cache, &dev_extent_cache); - if (err && !ret) + ret = check_devices(&dev_cache, &dev_extent_cache); + if (ret && err) ret = err; out: