From patchwork Sat Jan 8 10:09:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Young X-Patchwork-Id: 465541 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 p08A98DP013110 for ; Sat, 8 Jan 2011 10:09:08 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751461Ab1AHKJE (ORCPT ); Sat, 8 Jan 2011 05:09:04 -0500 Received: from mail-pw0-f46.google.com ([209.85.160.46]:51428 "EHLO mail-pw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751399Ab1AHKJD (ORCPT ); Sat, 8 Jan 2011 05:09:03 -0500 Received: by pwj3 with SMTP id 3so2453117pwj.19 for ; Sat, 08 Jan 2011 02:09:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=lYDl+G+ApbY1L+dugfHDjxb/1rYMILjbztzDrvrAjnE=; b=xYNHJmerCFwM9lPHoO+r27eDJlY7dWW+J+yshd4ivh52L0pONzUXyQLT9NfpJ/0+4I iH/LnzAjZ45Y9iRuKZlllz0tdVA2MCSA0i2IH8cWVm8gNXVtAWvhIbZRDy1Lei8sBZvW GQJRzLEbIn8ingTrSOFluqETPqAjJs/Gms/J0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=pMVnpJ4oUUBlAEXgU2OesYhDr2fRLGIQnYmqpjhliyYMqAfA3/yy0s6s8+m1P33Mqe 1whSRplQw2EWa656q5SaOqZJN/dF54UtOT+LyyP+/XOQnQM2+3ujmJa1KsRCYXMdj3Ct HQPXCzaNIuvMW0IPP6rh5B6b/s6d8kwJS1JvU= Received: by 10.142.216.15 with SMTP id o15mr2507064wfg.75.1294481342283; Sat, 08 Jan 2011 02:09:02 -0800 (PST) Received: from darkstar ([114.240.74.243]) by mx.google.com with ESMTPS id b11sm4013092wff.21.2011.01.08.02.08.58 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 08 Jan 2011 02:09:01 -0800 (PST) Date: Sat, 8 Jan 2011 18:09:13 +0800 From: Dave Young To: Chris Mason , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH retry] btrfs: mount failure return value fix Message-ID: <20110108100913.GA2659@darkstar> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) 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]); Sat, 08 Jan 2011 10:09:09 +0000 (UTC) --- linux-2.6.orig/fs/btrfs/disk-io.c 2010-12-29 21:53:17.473333338 +0800 +++ linux-2.6/fs/btrfs/disk-io.c 2010-12-29 21:57:37.916666672 +0800 @@ -1713,8 +1713,10 @@ struct btrfs_root *open_ctree(struct sup fs_info, BTRFS_ROOT_TREE_OBJECTID); bh = btrfs_read_dev_super(fs_devices->latest_bdev); - if (!bh) + if (!bh) { + err = -EINVAL; goto fail_iput; + } memcpy(&fs_info->super_copy, bh->b_data, sizeof(fs_info->super_copy)); memcpy(&fs_info->super_for_commit, &fs_info->super_copy, --- linux-2.6.orig/fs/btrfs/volumes.c 2010-12-29 21:53:17.503333338 +0800 +++ linux-2.6/fs/btrfs/volumes.c 2010-12-29 21:57:37.920000005 +0800 @@ -598,8 +598,10 @@ static int __btrfs_open_devices(struct b set_blocksize(bdev, 4096); bh = btrfs_read_dev_super(bdev); - if (!bh) + if (!bh) { + ret = -EINVAL; goto error_close; + } disk_super = (struct btrfs_super_block *)bh->b_data; devid = btrfs_stack_device_id(&disk_super->dev_item); @@ -700,7 +702,7 @@ int btrfs_scan_one_device(const char *pa goto error_close; bh = btrfs_read_dev_super(bdev); if (!bh) { - ret = -EIO; + ret = -EINVAL; goto error_close; } disk_super = (struct btrfs_super_block *)bh->b_data; @@ -1193,7 +1195,7 @@ int btrfs_rm_device(struct btrfs_root *r set_blocksize(bdev, 4096); bh = btrfs_read_dev_super(bdev); if (!bh) { - ret = -EIO; + ret = -EINVAL; goto error_close; } disk_super = (struct btrfs_super_block *)bh->b_data;