From patchwork Thu Jul 29 08:31:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miao Xie X-Patchwork-Id: 115011 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6T95YJ1028739 for ; Thu, 29 Jul 2010 09:05:34 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755338Ab0G2JFL (ORCPT ); Thu, 29 Jul 2010 05:05:11 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:49895 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1755110Ab0G2JEr (ORCPT ); Thu, 29 Jul 2010 05:04:47 -0400 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id 512BD170144; Thu, 29 Jul 2010 17:04:45 +0800 (CST) Received: from fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id o6T91led016081; Thu, 29 Jul 2010 17:01:47 +0800 Received: from [10.167.141.211] (unknown [10.167.141.211]) by fnst.cn.fujitsu.com (Postfix) with ESMTPA id 5EC2B14C00E; Thu, 29 Jul 2010 17:05:23 +0800 (CST) Message-ID: <4C513C66.8010109@cn.fujitsu.com> Date: Thu, 29 Jul 2010 16:31:34 +0800 From: Miao Xie Reply-To: miaox@cn.fujitsu.com User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100413 Fedora/3.0.4-2.fc13 Thunderbird/3.0.4 MIME-Version: 1.0 To: Chris Mason , Yan Zheng CC: Linux Kernel , Linux Btrfs Subject: [PATCH 6/7] btrfs: check the return value of btrfs_start_workers() in open_ctree() 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.3 (demeter.kernel.org [140.211.167.41]); Thu, 29 Jul 2010 09:05:34 +0000 (UTC) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 280de15..4dd6bf0 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -1775,15 +1775,30 @@ struct btrfs_root *open_ctree(struct super_block *sb, fs_info->endio_write_workers.idle_thresh = 2; fs_info->endio_meta_write_workers.idle_thresh = 2; - btrfs_start_workers(&fs_info->workers, 1); - btrfs_start_workers(&fs_info->generic_worker, 1); - btrfs_start_workers(&fs_info->submit_workers, 1); - btrfs_start_workers(&fs_info->delalloc_workers, 1); - btrfs_start_workers(&fs_info->fixup_workers, 1); - btrfs_start_workers(&fs_info->endio_workers, 1); - btrfs_start_workers(&fs_info->endio_meta_workers, 1); - btrfs_start_workers(&fs_info->endio_meta_write_workers, 1); - btrfs_start_workers(&fs_info->endio_write_workers, 1); + /* + * We must start generic_worker first because it is used to create + * other workers. + */ + ret = btrfs_start_workers(&fs_info->generic_worker, 1); + if (ret) { + printk(KERN_INFO "btrfs: start generic workers failed on %s\n", + sb->s_id); + goto fail_iput; + } + + ret |= btrfs_start_workers(&fs_info->workers, 1); + ret |= btrfs_start_workers(&fs_info->submit_workers, 1); + ret |= btrfs_start_workers(&fs_info->delalloc_workers, 1); + ret |= btrfs_start_workers(&fs_info->fixup_workers, 1); + ret |= btrfs_start_workers(&fs_info->endio_workers, 1); + ret |= btrfs_start_workers(&fs_info->endio_meta_workers, 1); + ret |= btrfs_start_workers(&fs_info->endio_meta_write_workers, 1); + ret |= btrfs_start_workers(&fs_info->endio_write_workers, 1); + if (ret) { + printk(KERN_INFO "btrfs: start other workers failed on %s\n", + sb->s_id); + goto fail_sb_buffer; + } fs_info->bdi.ra_pages *= btrfs_super_num_devices(disk_super); fs_info->bdi.ra_pages = max(fs_info->bdi.ra_pages,