From patchwork Thu Jul 4 09:48:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 2822641 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 51D989F3C3 for ; Thu, 4 Jul 2013 09:50:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3351D2015D for ; Thu, 4 Jul 2013 09:50:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2319020159 for ; Thu, 4 Jul 2013 09:50:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753414Ab3GDJuI (ORCPT ); Thu, 4 Jul 2013 05:50:08 -0400 Received: from mail-wi0-f180.google.com ([209.85.212.180]:36901 "EHLO mail-wi0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753387Ab3GDJuH (ORCPT ); Thu, 4 Jul 2013 05:50:07 -0400 Received: by mail-wi0-f180.google.com with SMTP id c10so1031548wiw.7 for ; Thu, 04 Jul 2013 02:50:05 -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:x-mailer:in-reply-to:references; bh=iUH/OE16ly2Ywns65NT9ATyRRckZMvTndsz5mmb37oE=; b=w2D0DojrZ4Q5HE7JM0QmyOH1cM3PjLXZK7vvh8BN7iFxctoD16l5jYEz6JrcK/5265 IVnPUKwixtaL6r+v+XiYA+jYMuqrGMkm9/FALGKx0R7A7cF4lWwbTQXRoFel7gsppLrj gZidZ/JWlicJx3KinIYSrSbPUs+ibrVsy1HZZIZRhIGBQfAZzdn89WiVQOJ+YUU7jb0h PFXhaXetdgHspHV4038LnvYqBkblkAjPcOk7GgoEGGg0opYZ5HUbhckIxgDDESlCVj0Q 0HQzXa0WUdDx7e5g636DGVZcPkC6EmLR3iFxVFLVNt0VpCAaL3aSljKKPBx32Iumjpx8 FO1Q== X-Received: by 10.180.187.47 with SMTP id fp15mr2863252wic.27.1372931405750; Thu, 04 Jul 2013 02:50:05 -0700 (PDT) Received: from storm-desktop.lan (bl10-255-64.dsl.telepac.pt. [85.243.255.64]) by mx.google.com with ESMTPSA id cd11sm2245454wib.10.2013.07.04.02.50.04 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 04 Jul 2013 02:50:05 -0700 (PDT) From: Filipe David Borba Manana To: linux-btrfs@vger.kernel.org Cc: Filipe David Borba Manana Subject: [PATCH 5/5] Btrfs-progs: don't ignore errors in btrfs_add_block_group() Date: Thu, 4 Jul 2013 10:48:40 +0100 Message-Id: <1372931320-8340-3-git-send-email-fdmanana@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1372931320-8340-1-git-send-email-fdmanana@gmail.com> References: <1372593106-6593-1-git-send-email-fdmanana@gmail.com> <1372931320-8340-1-git-send-email-fdmanana@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=-7.0 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 This function was not checking if the calls to set_extent_bits() and set_state_private() actually succeeded or not. Signed-off-by: Filipe David Borba Manana --- extent-tree.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/extent-tree.c b/extent-tree.c index b0cfe0a..d260c14 100644 --- a/extent-tree.c +++ b/extent-tree.c @@ -3355,12 +3355,14 @@ btrfs_add_block_group(struct btrfs_fs_info *fs_info, u64 bytes_used, u64 type, BUG_ON(ret); bit = block_group_state_bits(type); - set_extent_bits(block_group_cache, chunk_offset, - chunk_offset + size - 1, - bit | EXTENT_LOCKED, GFP_NOFS); + ret = set_extent_bits(block_group_cache, chunk_offset, + chunk_offset + size - 1, + bit | EXTENT_LOCKED, GFP_NOFS); + BUG_ON(ret); - set_state_private(block_group_cache, chunk_offset, - (unsigned long)cache); + ret = set_state_private(block_group_cache, chunk_offset, + (unsigned long)cache); + BUG_ON(ret); set_avail_alloc_bits(fs_info, type); return cache;