From patchwork Thu Jul 2 15:15:47 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Mack X-Patchwork-Id: 29405 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id CADAFB70E8 for ; Fri, 3 Jul 2009 01:18:32 +1000 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1MMO1j-00075N-Ho; Thu, 02 Jul 2009 15:16:43 +0000 Received: from buzzloop.caiaq.de ([212.112.241.133]) by bombadil.infradead.org with esmtps (Exim 4.69 #1 (Red Hat Linux)) id 1MMO1O-00073t-Gp for linux-mtd@lists.infradead.org; Thu, 02 Jul 2009 15:16:41 +0000 Received: from localhost (localhost [127.0.0.1]) by buzzloop.caiaq.de (Postfix) with ESMTP id CF10D7C8009; Thu, 2 Jul 2009 17:16:13 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at buzzloop.caiaq.de Received: from buzzloop.caiaq.de ([127.0.0.1]) by localhost (buzzloop.caiaq.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id l3Ioj-2YvmIN; Thu, 2 Jul 2009 17:16:11 +0200 (CEST) Received: from localhost.localdomain (pd95699b2.dip0.t-ipconnect.de [217.86.153.178]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by buzzloop.caiaq.de (Postfix) with ESMTPSA id C98637C8008; Thu, 2 Jul 2009 17:16:10 +0200 (CEST) From: Daniel Mack To: linux-kernel@vger.kernel.org Subject: [PATCH] ubifs: allow more than one volume to be mounted Date: Thu, 2 Jul 2009 17:15:47 +0200 Message-Id: <1246547747-13366-1-git-send-email-daniel@caiaq.de> X-Mailer: git-send-email 1.6.3.1 X-Spam-Score: 0.0 (/) Cc: linux-mtd@lists.infradead.org, Adrian Hunter , Daniel Mack X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org UBIFS uses a bdi device per volume, but does not care to hand out unique names to each of them. This causes an error when trying to mount more than one volumes. [ 239.277407] kobject_add_internal failed for ubifs with -EEXIST, don't try to register things with the same name in the same directory. [ 239.289618] [] (unwind_backtrace+0x0/0xdc) from [] (kobject_add_internal+0x188/0x1b8) [ 239.299445] [] (kobject_add_internal+0x188/0x1b8) from [] (kobject_add+0x48/0x5c) [ 239.308896] [] (kobject_add+0x48/0x5c) from [] (device_add+0xac/0x510) [ 239.317392] [] (device_add+0xac/0x510) from [] (device_create_vargs+0x70/0xa4) [ 239.326589] [] (device_create_vargs+0x70/0xa4) from [] (bdi_register+0x44/0x64) [ 239.335854] [] (bdi_register+0x44/0x64) from [] (ubifs_get_sb+0x3c8/0x10cc) [ 239.344769] [] (ubifs_get_sb+0x3c8/0x10cc) from [] (vfs_kern_mount+0x50/0xa8) [ 239.353867] [] (vfs_kern_mount+0x50/0xa8) from [] (do_kern_mount+0x34/0xd0) [ 239.362799] [] (do_kern_mount+0x34/0xd0) from [] (do_mount+0x644/0x6b4) [ 239.371377] [] (do_mount+0x644/0x6b4) from [] (sys_mount+0x84/0xcc) [ 239.379538] [] (sys_mount+0x84/0xcc) from [] (ret_fast_syscall+0x0/0x2c) Append the UBI volume and device ID to avoid that. Signed-off-by: Daniel Mack Cc: Artem Bityutskiy Cc: Adrian Hunter Cc: linux-mtd@lists.infradead.org --- fs/ubifs/super.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 79fad43..fca5ebe 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -1910,6 +1910,7 @@ static struct ubi_volume_desc *open_ubi(const char *name, int mode) static int ubifs_fill_super(struct super_block *sb, void *data, int silent) { struct ubi_volume_desc *ubi = sb->s_fs_info; + struct ubi_volume_info ubi_info; struct ubifs_info *c; struct inode *root; int err; @@ -1975,7 +1976,9 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent) err = bdi_init(&c->bdi); if (err) goto out_close; - err = bdi_register(&c->bdi, NULL, "ubifs"); + ubi_get_volume_info(ubi, &ubi_info); + err = bdi_register(&c->bdi, NULL, "ubifs_%d_%d", + ubi_info.ubi_num, ubi_info.vol_id); if (err) goto out_bdi;