From patchwork Sun Aug 14 20:11:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harinath Nampally X-Patchwork-Id: 9279823 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 AA2EF600CB for ; Sun, 14 Aug 2016 20:11:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B98228A13 for ; Sun, 14 Aug 2016 20:11:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9059728A21; Sun, 14 Aug 2016 20:11:38 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 30E3728A13 for ; Sun, 14 Aug 2016 20:11:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932199AbcHNULe (ORCPT ); Sun, 14 Aug 2016 16:11:34 -0400 Received: from mail-io0-f195.google.com ([209.85.223.195]:36617 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751497AbcHNULd (ORCPT ); Sun, 14 Aug 2016 16:11:33 -0400 Received: by mail-io0-f195.google.com with SMTP id y34so4767231ioi.3 for ; Sun, 14 Aug 2016 13:11:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id; bh=CxX4H4J0m15k4PC5ZESGXbj8uhTBL/ieYtMqLW+DFkA=; b=tJmUBOufiH15n850GmRleKutljoUkzso0ue7kopYMQZhZB0nA54sdn6KKyWCdn0efh wLfjo+TOL0g9EHuHSgYB+DyIKTvkfl4fOb/4aFgte7sZhv+FF15YNsJ/sBvh16eumidZ 1gqMmH9ybGEW/ibGQgqyQYfzeX+LsghB0QExiGIx3UNKZlyDXLHf6L2UqBRr+y6+BtG0 OgjqKereCAp2c883psL9l+OY/vOzP9bMx8rC8dNEucpB5mMU4daMtXVcpdsJvK7GIMTD H2+Y5AQ1ZE5eCNv83dEmU+sxIVCvGjjRGLgRUTURW6C4b5v/dG483y8MhQ+6ojcCEy66 3/DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=CxX4H4J0m15k4PC5ZESGXbj8uhTBL/ieYtMqLW+DFkA=; b=dgR6cdrj5mIQPKqpvXTUhLU05NkEuIU6iMJFW1l9CdRiO7UciGzKsU68zpd7d5CKLu 9W6VY6t5h7m/TsLwDSgn17LWfzgFxa3X1DQdJrN1pVf8VAa4M4DJ8GJz5wrYCmrvJHl+ N9bfogFu7VbmAaTKhOKayxeSQp8vlDRNFxCLAwcplGUo6jhWIPxa54SObTQoBQYgY246 1GdMimmHTfjGre75xFTgLIjJvC7dbSFDOJV8zIFieRpiMXQoYNUDQF5p2URMYoh/9TBB jK72Yl+j0lOMJo67V198hipAxULx0kjALcHEIYEXz7ZndzehB5cI70yL4xGkPlMyXhpt b6kw== X-Gm-Message-State: AEkoout7Ph8NRPUigyL87zc2yRPMuMwVjM4hsg0T1TkNSwFyUORxX0GKeaVDCpoBy7N60w== X-Received: by 10.107.148.74 with SMTP id w71mr32616956iod.47.1471205492303; Sun, 14 Aug 2016 13:11:32 -0700 (PDT) Received: from hary-Aspire-X3400G.Belkin (174-84-246-201.res.bhn.net. [174.84.246.201]) by smtp.googlemail.com with ESMTPSA id g100sm2973630ioj.1.2016.08.14.13.11.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 14 Aug 2016 13:11:31 -0700 (PDT) From: Harinath Nampally To: linux-btrfs@vger.kernel.org Subject: [PATCH] code cleanup Date: Sun, 14 Aug 2016 16:11:31 -0400 Message-Id: <1471205491-27411-1-git-send-email-harinath922@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch checks ret value and jumps to clean up in case of btrs_add_systme_chunk call fails Signed-off-by: Harinath Nampally --- fs/btrfs/volumes.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 366b335..fedb301 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -4880,12 +4880,15 @@ int btrfs_finish_chunk_alloc(struct btrfs_trans_handle *trans, ret = btrfs_insert_item(trans, chunk_root, &key, chunk, item_size); if (ret == 0 && map->type & BTRFS_BLOCK_GROUP_SYSTEM) { - /* - * TODO: Cleanup of inserted chunk root in case of - * failure. - */ ret = btrfs_add_system_chunk(chunk_root, &key, chunk, item_size); + if (ret) { + /* + * Cleanup of inserted chunk root in case of + * failure. + */ + goto out; + } } out: