From patchwork Tue Mar 12 14:07:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 2256541 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id EE5B83FCF6 for ; Tue, 12 Mar 2013 14:00:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754683Ab3CLOA1 (ORCPT ); Tue, 12 Mar 2013 10:00:27 -0400 Received: from dkim2.fusionio.com ([66.114.96.54]:55276 "EHLO dkim2.fusionio.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753889Ab3CLOA0 (ORCPT ); Tue, 12 Mar 2013 10:00:26 -0400 Received: from mx1.fusionio.com (unknown [10.101.1.160]) by dkim2.fusionio.com (Postfix) with ESMTP id 821209A0405 for ; Tue, 12 Mar 2013 08:00:24 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fusionio.com; s=default; t=1363096824; bh=KtPtC0zsBCkDkU1v83FStzq5/2SgRO8u7DieLrRF1Vo=; h=From:To:Subject:Date; b=mH3qvKMpqa2peaA0gg8aJFCGNkfDkjQmPafnJ9ZwO9Y9xEEZkEHEF+lbPD3etjEIb SPufZtUD0mALch0TG9Am2E0tjnvKEl3+l2SoyDvMQ2zJOGTidc2T+RXaoAK81N8xpC 62cP2u2GqNAvpJzPXVavuH442oKdIjM4Ymozt8UE= X-ASG-Debug-ID: 1363096823-03d6a5521e3ccb0002-6jHSXT Received: from mail1.int.fusionio.com (mail1.int.fusionio.com [10.101.1.21]) by mx1.fusionio.com with ESMTP id djLv7AqvrFLsloxs (version=TLSv1 cipher=AES128-SHA bits=128 verify=NO) for ; Tue, 12 Mar 2013 08:00:24 -0600 (MDT) X-Barracuda-Envelope-From: JBacik@fusionio.com Received: from localhost (98.26.82.158) by mail.fusionio.com (10.101.1.19) with Microsoft SMTP Server (TLS) id 8.3.83.0; Tue, 12 Mar 2013 08:00:23 -0600 From: Josef Bacik To: Subject: [PATCH] Btrfs-progs: alloc our super copy in btrfs-find-root Date: Tue, 12 Mar 2013 10:07:39 -0400 X-ASG-Orig-Subj: [PATCH] Btrfs-progs: alloc our super copy in btrfs-find-root Message-ID: <1363097259-1860-1-git-send-email-jbacik@fusionio.com> X-Mailer: git-send-email 1.7.7.6 MIME-Version: 1.0 X-Barracuda-Connect: mail1.int.fusionio.com[10.101.1.21] X-Barracuda-Start-Time: 1363096824 X-Barracuda-Encrypted: AES128-SHA X-Barracuda-URL: http://10.101.1.180:8000/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at fusionio.com X-Barracuda-Bayes: INNOCENT GLOBAL 0.0000 1.0000 -2.0210 X-Barracuda-Spam-Score: -2.02 X-Barracuda-Spam-Status: No, SCORE=-2.02 using per-user scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.2.124994 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Dave fixed the fs_info to allocate the super copy instead of embedding it, but he failed to notice that I open code open_ctree in btrfs-find-root so we end up with a super that's not allocated, so we segfault whenever you try to run btrfs-find-root. I've fixed this up and now we don't segfault anymore. Thanks, Signed-off-by: Josef Bacik --- find-root.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/find-root.c b/find-root.c index f99fb76..810d835 100644 --- a/find-root.c +++ b/find-root.c @@ -116,6 +116,7 @@ static struct btrfs_root *open_ctree_broken(int fd, const char *device) } memset(fs_info, 0, sizeof(*fs_info)); + fs_info->super_copy = calloc(1, BTRFS_SUPER_INFO_SIZE); fs_info->tree_root = tree_root; fs_info->extent_root = extent_root; fs_info->chunk_root = chunk_root;