From patchwork Tue Mar 5 19:22:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 2221241 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 888343FCF2 for ; Tue, 5 Mar 2013 19:22:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756970Ab3CETWX (ORCPT ); Tue, 5 Mar 2013 14:22:23 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58825 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755467Ab3CETWX (ORCPT ); Tue, 5 Mar 2013 14:22:23 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r25JMM9r018640 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 5 Mar 2013 14:22:22 -0500 Received: from tlielax.poochiereds.net (vpn-52-208.rdu2.redhat.com [10.10.52.208]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r25JML2L014624; Tue, 5 Mar 2013 14:22:22 -0500 Date: Tue, 5 Mar 2013 14:22:20 -0500 From: Jeff Layton To: Jeff Layton Cc: Ben Greear , linux-cifs@vger.kernel.org, Linux Kernel Mailing List Subject: Re: 3.7.10+: BUG Dentry still in use [unmount of cifs cifs] Message-ID: <20130305142220.6fc20a2b@tlielax.poochiereds.net> In-Reply-To: <20130305140849.67d52088@tlielax.poochiereds.net> References: <51363F80.8070609@candelatech.com> <20130305140849.67d52088@tlielax.poochiereds.net> Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org On Tue, 5 Mar 2013 14:08:49 -0500 Jeff Layton wrote: > On Tue, 05 Mar 2013 10:54:56 -0800 > Ben Greear wrote: > > > In doing some CIFS testing (utilizing it's feature to bind to local > > address..but not sure that matters), we saw this error when trying > > to un-mount. > > > > Our kernel is patched (nfs, some networking related patches), but there > > are no out-of-kernel patches to CIFS, so I don't *think* this is anything > > we could have caused. > > > > This problem appears to be easily reproducible, so we will be happy > > to test patches if anyone has any suggestions. > > > > BUG: Dentry ffff8800c07e43c0{i=45762,n=cifs2-01.7.lf-data} still in use (1) [unmount of cifs cifs] > > ------------[ cut here ]------------ > > kernel BUG at /home/greearb/git/linux-3.7.dev.y/fs/dcache.c:967! > > invalid opcode: 0000 [#1] PREEMPT SMP > > Modules linked in: nls_utf8 cifs 8021q garp stp llc iptable_raw xt_CT veth nf_nat_ipv4 nf_nat fuse macvlan wanlink(O) pktgen nfsv3 nfs_acl nfsv4 auth_rpcgss nfs > > fscache lockd sunrpc be2iscsi iscsi_boot_sysfs bnx2i cnic uio cxgb4i cxgb4 cxgb3i cxgb3 mdio libcxgbi ib_iser rdma_cm ib_addr iw_cm ib_cm ib_sa ib_mad ib_core > > w83793 iscsi_tcp w83627hf libiscsi_tcp hwmon_vid libiscsi scsi_transport_iscsi coretemp mperf kvm_intel kvm i5k_amb uinput i5000_edac gpio_ich edac_core > > iTCO_wdt e1000e iTCO_vendor_support lpc_ich i2c_i801 pcspkr ioatdma dca microcode shpchp ipv6 floppy radeon i2c_algo_bit hwmon drm_kms_helper ttm drm i2c_core > > [last unloaded: iptable_nat] > > CPU 6 > > Pid: 6610, comm: umount Tainted: G C O 3.7.10+ #74 Supermicro X7DBU/X7DBU > > RIP: 0010:[] [] shrink_dcache_for_umount_subtree+0x84/0x194 > > RSP: 0018:ffff8800c0085dc8 EFLAGS: 00010296 > > RAX: 0000000000000062 RBX: ffff8800c07e43c0 RCX: 0000000000000059 > > RDX: ffffffff81bc25a8 RSI: 0000000000000046 RDI: 0000000000000246 > > RBP: ffff8800c0085de8 R08: 0000000000000001 R09: ffff8800c0085cc8 > > R10: 0000000000000000 R11: 0000000000000000 R12: ffff8800c050e9c0 > > R13: ffff880128ee8000 R14: 0000000000000000 R15: ffff8800c0085f28 > > FS: 00007f6084847840(0000) GS:ffff88012fd80000(0000) knlGS:0000000000000000 > > CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b > > CR2: 00007f608442c3a0 CR3: 00000000c7c2d000 CR4: 00000000000007e0 > > DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 > > DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 > > Process umount (pid: 6610, threadinfo ffff8800c0084000, task ffff88012a6a0000) > > Stack: > > ffff880128ee8310 00000000000128c0 ffff880128ee8000 ffffffffa06b96b0 > > ffff8800c0085e08 ffffffff81159310 ffff8800c0084000 ffff880128ee8000 > > ffff8800c0085e38 ffffffff81149afe ffff8800c0085e38 0000000000000021 > > Call Trace: > > [] shrink_dcache_for_umount+0x37/0x49 > > [] generic_shutdown_super+0x20/0xd2 > > [] kill_anon_super+0x11/0x1c > > [] cifs_kill_sb+0x15/0x21 [cifs] > > [] deactivate_locked_super+0x32/0x5e > > [] deactivate_super+0x40/0x46 > > [] mntput_no_expire+0x12d/0x136 > > [] sys_umount+0x321/0x34c > > [] ? path_put+0x1d/0x21 > > [] system_call_fastpath+0x16/0x1b > > Code: 50 28 4c 8b 0a 31 d2 48 85 f6 74 04 48 8b 56 40 48 05 10 03 00 00 48 89 de 48 c7 c7 9d d0 7b 81 48 89 04 24 31 c0 e8 b9 4e 3c 00 <0f> 0b eb fe 4c 8b 63 18 > > 4c 39 e3 75 3c 48 8b 93 90 00 00 00 48 > > RIP [] shrink_dcache_for_umount_subtree+0x84/0x194 > > RSP > > ---[ end trace 9b2978a89532c292 ]--- > > Hmmm...dentry leak. Are there any jobs queued to the cifsiod workqueue > when the box oopses? > In fact... It's just a guess, but does this patch help at all? Note that it builds but is otherwise untested ;). If it works we might want to go with something a bit less invasive but this may tell us if we're on the right track. ------------------[snip]------------------ [PATCH] cifs: flush cifsiod workqueue before unmounting It's possible that we'll end up with some writeback activity going on while the fs is unmounted. If that happens we'll queue some work to a workqueue to handle the last bit of cleanup. At that point though, there's nothing pinning down the superblock, so it's possible to race with a umount. There will still be an active cifsFileInfo reference, and that will hold a reference to a dentry. That, in turn, can cause a "Dentry still in use" error. Flush the cifsiod workqueue before allowing a umount to proceed. Reported-by: Ben Greear Signed-off-by: Jeff Layton --- fs/cifs/connect.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 991c63c..7840f3f 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -3815,6 +3815,7 @@ cifs_umount(struct cifs_sb_info *cifs_sb) struct tcon_link *tlink; cancel_delayed_work_sync(&cifs_sb->prune_tlinks); + flush_workqueue(cifsiod_wq); spin_lock(&cifs_sb->tlink_tree_lock); while ((node = rb_first(root))) {