From patchwork Tue Nov 9 04:10:00 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Kent X-Patchwork-Id: 310142 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 oA94AMHn014759 for ; Tue, 9 Nov 2010 04:10:22 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752248Ab0KIEKJ (ORCPT ); Mon, 8 Nov 2010 23:10:09 -0500 Received: from out3.smtp.messagingengine.com ([66.111.4.27]:49084 "EHLO out3.smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751520Ab0KIEKI (ORCPT ); Mon, 8 Nov 2010 23:10:08 -0500 Received: from compute2.internal (compute2.nyi.mail.srv.osa [10.202.2.42]) by gateway1.messagingengine.com (Postfix) with ESMTP id 8D91253E; Mon, 8 Nov 2010 23:10:07 -0500 (EST) Received: from frontend2.messagingengine.com ([10.202.2.161]) by compute2.internal (MEProxy); Mon, 08 Nov 2010 23:10:07 -0500 X-Sasl-enc: ZPSU9oQfRztdRkpSeEy+lLEjz+BDUGv1ak+XRoGKaOMZ 1289275805 Received: from [10.49.97.32] (203-206-67-179.dyn.iinet.net.au [203.206.67.179]) by mail.messagingengine.com (Postfix) with ESMTPSA id EF03E5E3072; Mon, 8 Nov 2010 23:10:04 -0500 (EST) Subject: Re: mkfs.btrfs on 24 disks in parallel crashes kernel From: Ian Kent To: Albert Strasheim Cc: linux-btrfs@vger.kernel.org In-Reply-To: References: Date: Tue, 09 Nov 2010 12:10:00 +0800 Message-ID: <1289275800.9102.16.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 (2.28.3-1.fc12) 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 (demeter1.kernel.org [140.211.167.41]); Tue, 09 Nov 2010 04:10:22 +0000 (UTC) diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 718b10d..9b463b9 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -565,6 +565,8 @@ static int btrfs_test_super(struct super_block *s, void *data) struct btrfs_fs_devices *test_fs_devices = data; struct btrfs_root *root = btrfs_sb(s); + if (!root) + return 0; return root->fs_info->fs_devices == test_fs_devices; } @@ -585,6 +587,7 @@ static int btrfs_get_sb(struct file_system_type *fs_type, int flags, char *subvol_name = NULL; u64 subvol_objectid = 0; int error = 0; + DEFINE_MUTEX(super_mutex); if (!(flags & MS_RDONLY)) mode |= FMODE_WRITE; @@ -613,8 +616,10 @@ static int btrfs_get_sb(struct file_system_type *fs_type, int flags, if (IS_ERR(s)) goto error_s; + mutex_lock(&super_mutex); if (s->s_root) { if ((flags ^ s->s_flags) & MS_RDONLY) { + mutex_unlock(&super_mutex); deactivate_locked_super(s); error = -EBUSY; goto error_close_devices; @@ -629,6 +634,7 @@ static int btrfs_get_sb(struct file_system_type *fs_type, int flags, error = btrfs_fill_super(s, fs_devices, data, flags & MS_SILENT ? 1 : 0); if (error) { + mutex_unlock(&super_mutex); deactivate_locked_super(s); goto error_free_subvol_name; } @@ -636,6 +642,7 @@ static int btrfs_get_sb(struct file_system_type *fs_type, int flags, btrfs_sb(s)->fs_info->bdev_holder = fs_type; s->s_flags |= MS_ACTIVE; } + mutex_unlock(&super_mutex); root = get_default_root(s, subvol_objectid); if (IS_ERR(root)) {