From patchwork Thu May 29 10:01:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Shilong X-Patchwork-Id: 4263781 X-Patchwork-Delegate: dave@jikos.cz 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 42C5B9F1E7 for ; Thu, 29 May 2014 10:05:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 64CCD20306 for ; Thu, 29 May 2014 10:05:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 840FB201FA for ; Thu, 29 May 2014 10:05:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755928AbaE2KFS (ORCPT ); Thu, 29 May 2014 06:05:18 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:49078 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751045AbaE2KFR (ORCPT ); Thu, 29 May 2014 06:05:17 -0400 X-IronPort-AV: E=Sophos;i="4.98,933,1392134400"; d="scan'208";a="31187273" Received: from unknown (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 29 May 2014 18:02:41 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id s4TA5Gjh005256 for ; Thu, 29 May 2014 18:05:16 +0800 Received: from wangs.fnst.cn.fujitsu.com (10.167.226.104) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.146.2; Thu, 29 May 2014 18:05:16 +0800 From: Wang Shilong To: Subject: [PATCH 1/3] Btrfs-progs: fsck: finish transaction commit if repair error out Date: Thu, 29 May 2014 18:01:42 +0800 Message-ID: <1401357704-9752-1-git-send-email-wangsl.fnst@cn.fujitsu.com> X-Mailer: git-send-email 1.9.0 MIME-Version: 1.0 X-Originating-IP: [10.167.226.104] 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.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 If btrfsck fail to repair, we hit something like following: Check tree block failed, want=29442048, have=0 Check tree block failed, want=29442048, have=0 Check tree block failed, want=29442048, have=0 Check tree block failed, want=29442048, have=0 Check tree block failed, want=29442048, have=0 read block failed check_tree_block found 98304 bytes used err is 1 total csum bytes: 0 total tree bytes: 0 total fs tree bytes: 0 total extent tree bytes: 0 btree space waste bytes: 0 file data blocks allocated: 0 referenced 0 Btrfs v3.14.2-rc2-63-g3944f15 btrfs: transaction.h:38: btrfs_start_transaction: Assertion `!(root->commit_root)' failed. Aborted (core dumped) This is because under repair mode, we will start a transaction, and if we error out, we don't finish this transaction. So in close_ctree(), it will try to start and commit transaction which causes the above segmentation. Signed-off-by: Wang Shilong --- cmds-check.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmds-check.c b/cmds-check.c index 5bceb43..00d37b8 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -6334,12 +6334,12 @@ again: if (err && !ret) ret = err; +out: if (trans) { err = btrfs_commit_transaction(trans, root); if (!ret) ret = err; } -out: if (repair) { free_corrupt_blocks_tree(root->fs_info->corrupt_blocks); root->fs_info->fsck_extent_cache = NULL;