Return-Path: Received: from mail-it0-f53.google.com ([209.85.214.53]:35180 "EHLO mail-it0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755219AbdEDN6I (ORCPT ); Thu, 4 May 2017 09:58:08 -0400 Received: by mail-it0-f53.google.com with SMTP id c15so18140726ith.0 for ; Thu, 04 May 2017 06:58:08 -0700 (PDT) Subject: Re: [PATCH] nfs: Fix bdi handling for cloned superblocks To: Jan Kara References: <20170504070242.31501-1-jack@suse.cz> Cc: linux-block@vger.kernel.org, linux-nfs@vger.kernel.org, Anna Schumaker , Trond Myklebust , Corentin Labbe From: Jens Axboe Message-ID: <289c8d37-a292-2701-b03b-250f904fd022@kernel.dk> Date: Thu, 4 May 2017 07:58:06 -0600 MIME-Version: 1.0 In-Reply-To: <20170504070242.31501-1-jack@suse.cz> Content-Type: text/plain; charset=windows-1252 Sender: linux-nfs-owner@vger.kernel.org List-ID: On 05/04/2017 01:02 AM, Jan Kara wrote: > In commit 0d3b12584972 "nfs: Convert to separately allocated bdi" I have > wrongly cloned bdi reference in nfs_clone_super(). Further inspection > has shown that originally the code was actually allocating a new bdi (in > ->clone_server callback) which was later registered in > nfs_fs_mount_common() and used for sb->s_bdi in nfs_initialise_sb(). > This could later result in bdi for the original superblock not getting > unregistered when that superblock got shutdown (as the cloned sb still > held bdi reference) and later when a new superblock was created under > the same anonymous device number, a clash in sysfs has happened on bdi > registration: > > ------------[ cut here ]------------ > WARNING: CPU: 1 PID: 10284 at /linux-next/fs/sysfs/dir.c:31 sysfs_warn_dup+0x64/0x74 > sysfs: cannot create duplicate filename '/devices/virtual/bdi/0:32' > Modules linked in: axp20x_usb_power gpio_axp209 nvmem_sunxi_sid sun4i_dma sun4i_ss virt_dma > CPU: 1 PID: 10284 Comm: mount.nfs Not tainted 4.11.0-rc4+ #14 > Hardware name: Allwinner sun7i (A20) Family > [] (unwind_backtrace) from [] (show_stack+0x10/0x14) > [] (show_stack) from [] (dump_stack+0x78/0x8c) > [] (dump_stack) from [] (__warn+0xe8/0x100) > [] (__warn) from [] (warn_slowpath_fmt+0x38/0x48) > [] (warn_slowpath_fmt) from [] (sysfs_warn_dup+0x64/0x74) > [] (sysfs_warn_dup) from [] (sysfs_create_dir_ns+0x84/0x94) > [] (sysfs_create_dir_ns) from [] (kobject_add_internal+0x9c/0x2ec) > [] (kobject_add_internal) from [] (kobject_add+0x48/0x98) > [] (kobject_add) from [] (device_add+0xe4/0x5a0) > [] (device_add) from [] (device_create_groups_vargs+0xac/0xbc) > [] (device_create_groups_vargs) from [] (device_create_vargs+0x20/0x28) > [] (device_create_vargs) from [] (bdi_register_va+0x44/0xfc) > [] (bdi_register_va) from [] (super_setup_bdi_name+0x48/0xa4) > [] (super_setup_bdi_name) from [] (nfs_fill_super+0x1a4/0x204) > [] (nfs_fill_super) from [] (nfs_fs_mount_common+0x140/0x1e8) > [] (nfs_fs_mount_common) from [] (nfs4_remote_mount+0x50/0x58) > [] (nfs4_remote_mount) from [] (mount_fs+0x14/0xa4) > [] (mount_fs) from [] (vfs_kern_mount+0x54/0x128) > [] (vfs_kern_mount) from [] (nfs_do_root_mount+0x80/0xa0) > [] (nfs_do_root_mount) from [] (nfs4_try_mount+0x28/0x3c) > [] (nfs4_try_mount) from [] (nfs_fs_mount+0x2cc/0x8c4) > [] (nfs_fs_mount) from [] (mount_fs+0x14/0xa4) > [] (mount_fs) from [] (vfs_kern_mount+0x54/0x128) > [] (vfs_kern_mount) from [] (do_mount+0x158/0xc7c) > [] (do_mount) from [] (SyS_mount+0x8c/0xb4) > [] (SyS_mount) from [] (ret_fast_syscall+0x0/0x3c) > > Fix the problem by always creating new bdi for a superblock as we used > to do. > > Reported-and-tested-by: Corentin Labbe > Fixes: 0d3b12584972ce5781179ad3f15cca3cdb5cae05 > Signed-off-by: Jan Kara > --- > fs/nfs/internal.h | 6 +++--- > fs/nfs/super.c | 28 ++++++++++------------------ > 2 files changed, 13 insertions(+), 21 deletions(-) > > Hi Jens, > > can you please merge this fix to my series converting BDI handling in > filesystems? Thanks! Yep, added for a later pull in this merge window. Thanks Jan. -- Jens Axboe