lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <4C513C66.8010109@cn.fujitsu.com>
Date:	Thu, 29 Jul 2010 16:31:34 +0800
From:	Miao Xie <miaox@...fujitsu.com>
To:	Chris Mason <chris.mason@...cle.com>,
	Yan Zheng <zheng.yan@...cle.com>
CC:	Linux Kernel <linux-kernel@...r.kernel.org>,
	Linux Btrfs <linux-btrfs@...r.kernel.org>
Subject: [PATCH 6/7] btrfs: check the return value of btrfs_start_workers()
 in open_ctree()

If btrfs_start_workers() failed, we must stop mounting the btrfs, otherwise
the btrfs can't run well because there is no kthread to deal with the request
submited by it.

Signed-off-by: Miao Xie <miaox@...fujitsu.com>
---
 fs/btrfs/disk-io.c |   33 ++++++++++++++++++++++++---------
 1 files changed, 24 insertions(+), 9 deletions(-)

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,
-- 
1.7.0.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ