From patchwork Tue Apr 16 07:15:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 10902071 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 06EAA139A for ; Tue, 16 Apr 2019 07:15:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DEFF9286D4 for ; Tue, 16 Apr 2019 07:15:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CE4E328720; Tue, 16 Apr 2019 07:15:32 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 7976F286D4 for ; Tue, 16 Apr 2019 07:15:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727424AbfDPHPb (ORCPT ); Tue, 16 Apr 2019 03:15:31 -0400 Received: from mx2.suse.de ([195.135.220.15]:46196 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725865AbfDPHPa (ORCPT ); Tue, 16 Apr 2019 03:15:30 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id B7082ACD0 for ; Tue, 16 Apr 2019 07:15:29 +0000 (UTC) From: Qu Wenruo To: linux-btrfs@vger.kernel.org Subject: [PATCH 0/3] btrfs-progs: Handle error properly in btrfs_commit_transaction() Date: Tue, 16 Apr 2019 15:15:23 +0800 Message-Id: <20190416071526.3576-1-wqu@suse.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 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 patchset can be fetched from github: https://github.com/adam900710/btrfs-progs/tree/commit_failure_cleanup This patchset will address the BUG_ON() triggered in fuzz-tests/003 and fuzz-tests/009. For proper error handling in btrfs_commit_transaction(), we need a way to clean up per-transaction data properly. Currently we only have delayed refs which are per-transaction, so introduce a new function, btrfs_destroy_delayed_refs() to cleanup delayed refs. Now btrfs_commit_transaction() can error out gracefully with proper cleanup. Patch 1 and 2 are just some minor cleanups found when crafting the 3rd patch. Qu Wenruo (3): btrfs-progs: Remove the dead branch in btrfs_run_delayed_refs() btrfs-progs: Refactor btrfs_finish_extent_commit() btrfs-progs: Handle error properly in btrfs_commit_transaction() ctree.h | 4 +--- delayed-ref.c | 24 ++++++++++++++++++++++++ delayed-ref.h | 5 +++++ extent-tree.c | 22 +++++++++------------- transaction.c | 23 +++++++++++++++-------- 5 files changed, 54 insertions(+), 24 deletions(-)