From patchwork Tue Aug 23 10:25:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Sterba X-Patchwork-Id: 9295425 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 7A61760757 for ; Tue, 23 Aug 2016 10:45:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CAF028BBC for ; Tue, 23 Aug 2016 10:45:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 61D6B28BE1; Tue, 23 Aug 2016 10:45:35 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 DD3FA28BBC for ; Tue, 23 Aug 2016 10:45:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757490AbcHWKpU (ORCPT ); Tue, 23 Aug 2016 06:45:20 -0400 Received: from mx2.suse.de ([195.135.220.15]:59405 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756367AbcHWKno (ORCPT ); Tue, 23 Aug 2016 06:43:44 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 12EC2AD97 for ; Tue, 23 Aug 2016 10:26:26 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id 01D1EDAA3C; Tue, 23 Aug 2016 12:25:20 +0200 (CEST) From: David Sterba To: linux-btrfs@vger.kernel.org Cc: David Sterba Subject: [PATCH 11/13] btrfs-progs: mkfs: handle and report transaction commit failures Date: Tue, 23 Aug 2016 12:25:15 +0200 Message-Id: <1471947917-5324-12-git-send-email-dsterba@suse.com> X-Mailer: git-send-email 2.7.1 In-Reply-To: <1471947917-5324-1-git-send-email-dsterba@suse.com> References: <1471947917-5324-1-git-send-email-dsterba@suse.com> 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 Signed-off-by: David Sterba --- mkfs.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/mkfs.c b/mkfs.c index c28a8bb7e983..f063323903dc 100644 --- a/mkfs.c +++ b/mkfs.c @@ -1063,7 +1063,11 @@ static int make_image(char *source_dir, struct btrfs_root *root, int out_fd) error("unable to traverse directory %s: %d", source_dir, ret); goto fail; } - btrfs_commit_transaction(trans, root); + ret = btrfs_commit_transaction(trans, root); + if (ret) { + error("transaction commit failed: %d", ret); + goto out; + } if (verbose) printf("Making image is completed.\n"); @@ -1784,7 +1788,11 @@ int main(int argc, char **argv) exit(1); } - btrfs_commit_transaction(trans, root); + ret = btrfs_commit_transaction(trans, root); + if (ret) { + error("unable to commit transaction: %d", ret); + goto out; + } trans = btrfs_start_transaction(root, 1); if (!trans) { @@ -1858,7 +1866,11 @@ int main(int argc, char **argv) goto out; } - btrfs_commit_transaction(trans, root); + ret = btrfs_commit_transaction(trans, root); + if (ret) { + error("unable to commit transaction: %d", ret); + goto out; + } if (source_dir_set) { trans = btrfs_start_transaction(root, 1);