From patchwork Tue Feb 1 13:54:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Schmidt X-Patchwork-Id: 523071 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p11ESRZA003439 for ; Tue, 1 Feb 2011 14:28:28 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756942Ab1BAO2R (ORCPT ); Tue, 1 Feb 2011 09:28:17 -0500 Received: from vroomfondel.rzone.de ([81.169.147.145]:41692 "EHLO vroomfondel.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754571Ab1BAO2Q (ORCPT ); Tue, 1 Feb 2011 09:28:16 -0500 Received: from sensei.trapni.de (oglaroon.iata [192.168.96.10]) by vroomfondel.rzone.de (Postfix) with ESMTP id 3B3ED4AFE; Tue, 1 Feb 2011 14:55:42 +0100 (MET) Received: by sensei.trapni.de (Postfix, from userid 0) id 3D1669C08FE; Tue, 1 Feb 2011 14:54:50 +0100 (CET) From: Jan Schmidt To: linux-btrfs@vger.kernel.org Cc: chris.mason@oracle.com, sensille@gmx.net Subject: [PATCH 3/7] check open_ctree() right after it returned Date: Tue, 1 Feb 2011 14:54:46 +0100 Message-Id: <1296568490-13264-4-git-send-email-list.btrfs@jan-o-sch.net> X-Mailer: git-send-email 1.7.2.2 In-Reply-To: <1296568490-13264-1-git-send-email-list.btrfs@jan-o-sch.net> References: <1296568490-13264-1-git-send-email-list.btrfs@jan-o-sch.net> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 01 Feb 2011 14:28:28 +0000 (UTC) diff --git a/mkfs.c b/mkfs.c index d1dd4a3..0a80d1c 100644 --- a/mkfs.c +++ b/mkfs.c @@ -430,7 +430,13 @@ int main(int ac, char **av) fprintf(stderr, "error during mkfs %d\n", ret); exit(1); } + root = open_ctree(file, 0, O_RDWR); + if (!root) { + fprintf(stderr, "ctree init failed\n"); + return -1; + } + root->fs_info->alloc_start = alloc_start; ret = make_root_dir(root); @@ -445,10 +451,6 @@ int main(int ac, char **av) goto raid_groups; btrfs_register_one_device(file); - if (!root) { - fprintf(stderr, "ctree init failed\n"); - return -1; - } zero_end = 1; while(ac-- > 0) {