From owner-svn-src-all@freebsd.org Mon Aug 8 23:48:37 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 14697BB3CEE; Mon, 8 Aug 2016 23:48:37 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: from mail-qt0-x230.google.com (mail-qt0-x230.google.com [IPv6:2607:f8b0:400d:c0d::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C13A017C6; Mon, 8 Aug 2016 23:48:36 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: by mail-qt0-x230.google.com with SMTP id x25so211513267qtx.2; Mon, 08 Aug 2016 16:48:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=LGUunRkbNxM8TI4w9E/tthN6g+H8GMmCZmpjIodfU2E=; b=sEbnXK+LroE91I+7a1Z2adjRoz6HAdRDk+PwjFh4fJeM87a3AQcs6dW9A8n4y4TZ7d wy3pbTKkk46IDJRmKBkV8JBSurbBGPelpdK1t3FY1o/Zh157GgJ57B9sj6WygsfW8W9e AnKjq3oF4lsFsf3FBnRveXN0Y0CWouBIzrb2lulVZsBneGDX13N71mCX/TQQGSvCpKWe Dtzdl/FoSTLOfJcWm5GBrxUBBc1WlqAHdLo0U0PLsNTfAssp/a0Js/gkjZTE4mxYDt+L ntpIdVG7B3DZ2FaCV+Kiu5Z6mFtUKoJ2NubcHVfOEVoZ6ZQuLZA+glEOV8w0COZ4Uc3/ cDIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=LGUunRkbNxM8TI4w9E/tthN6g+H8GMmCZmpjIodfU2E=; b=OZuO3l1yMrBJ5yICkOy+S+uT5Z/eJE4BOPkuIAnH2C8uWCTrOHaSSUZBmz5r/yceH6 vX/EoUvYDT5Y4rpasRVcJqeNofoypEcem1D/SPf/ckb0Qixw8HshAGn6Ht1XdfwbtKTW uTgQNiAx+f1hLt218ohSjrJqE/X3CWu9jFifinjCtnjjShgY2xxi5MaohBY8zxvqg61j yS/AKpVta/L0/r28zv6oXR4oL6oZS5/qARK0jqx2t9qusaJD8Hy1fWyk+txssleZiFrt rfnh2b8yiUNxBX2eY9OvCWOjyvnAoi2nxoAOccmByW5QPQTHXjMPLWJPH7L1tHnq9F8G 76Xg== X-Gm-Message-State: AEkoouul4ozLjntLdeAVNLy9K+fwAfGupCeJO//aDTqpEXstTUZdB2dtEaZFhmbPI/oyMQ== X-Received: by 10.200.43.105 with SMTP id 38mr31581708qtv.73.1470700115566; Mon, 08 Aug 2016 16:48:35 -0700 (PDT) Received: from [10.192.166.0] (stargate.chelsio.com. [12.32.117.8]) by smtp.googlemail.com with ESMTPSA id k20sm18815801qkl.2.2016.08.08.16.48.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Aug 2016 16:48:34 -0700 (PDT) Sender: Navdeep Parhar Subject: Re: svn commit: r303763 - in head/sys/cddl: compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs contrib/opensolaris/uts/common/fs/zfs/sys To: Andriy Gapon , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201608050623.u756N695018889@repo.freebsd.org> From: Navdeep Parhar Message-ID: Date: Mon, 8 Aug 2016 16:48:32 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <201608050623.u756N695018889@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2016 23:48:37 -0000 Hello Andriy, I'm at r303837 and have had two panics today in zfs_rename. I have a core for a kernel built with -O0. Let me know if you think it's related to this commit and need more information. This is the stack: (also available at https://people.freebsd.org/~np/rename_panic.txt in case the wide lines are hard to read in email). (kgdb) bt #0 doadump (textdump=0) at /root/ws/head/sys/kern/kern_shutdown.c:298 #1 0xffffffff803f8692 in db_dump (dummy=-2100833195, dummy2=false, dummy3=-1, dummy4=0xfffffe08604c6810 "") at /root/ws/head/sys/ddb/db_command.c:533 #2 0xffffffff803f847e in db_command (last_cmdp=0xffffffff821d40d8 , cmd_table=0x0, dopager=1) at /root/ws/head/sys/ddb/db_command.c:440 #3 0xffffffff803f801e in db_command_loop () at /root/ws/head/sys/ddb/db_command.c:493 #4 0xffffffff803fcf13 in db_trap (type=12, code=0) at /root/ws/head/sys/ddb/db_main.c:251 #5 0xffffffff8100116f in kdb_trap (type=12, code=0, tf=0xfffffe08604c6fe0) at /root/ws/head/sys/kern/subr_kdb.c:654 #6 0xffffffff8163df24 in trap_fatal (frame=0xfffffe08604c6fe0, eva=18446744069414584336) at /root/ws/head/sys/amd64/amd64/trap.c:836 #7 0xffffffff8163e53b in trap_pfault (frame=0xfffffe08604c6fe0, usermode=0) at /root/ws/head/sys/amd64/amd64/trap.c:763 #8 0xffffffff8163d1e2 in trap (frame=0xfffffe08604c6fe0) at /root/ws/head/sys/amd64/amd64/trap.c:442 #9 0xffffffff8163e63a in trap_check (frame=0xfffffe08604c6fe0) at /root/ws/head/sys/amd64/amd64/trap.c:635 #10 #11 0xffffffff82c7d455 in zfs_rename (sdvp=0xfffff80016e331d8, svpp=0xfffffe08604c7318, scnp=0xfffffe08604c7750, tdvp=0xfffff80156440000, tvpp=0xfffffe08604c7308, tcnp=0xfffffe08604c7688, cr=0xfffff8001612e600) at /root/ws/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c:3959 #12 0xffffffff82c6f6a9 in zfs_freebsd_rename (ap=0xfffffe08604c73c8) at /root/ws/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c:5275 #13 0xffffffff8187d484 in VOP_RENAME_APV (vop=0xffffffff82d19bb0 , a=0xfffffe08604c73c8) at vnode_if.c:1547 #14 0xffffffff810e5d41 in VOP_RENAME (fdvp=0xfffff80016e331d8, fvp=0xfffff80174c02588, fcnp=0xfffffe08604c7750, tdvp=0xfffff80156440000, tvp=0xfffff8017d7d1ce8, tcnp=0xfffffe08604c7688) at ./vnode_if.h:636 #15 0xffffffff810e5b17 in kern_renameat (td=0xfffff8010b855a40, oldfd=-100, old=0x800a121a0 , newfd=-100, new=0x7fffffffcfee , pathseg=UIO_USERSPACE) at /root/ws/head/sys/kern/vfs_syscalls.c:3553 #16 0xffffffff810e53d7 in sys_rename (td=0xfffff8010b855a40, uap=0xfffffe08604c7a58) at /root/ws/head/sys/kern/vfs_syscalls.c:3427 #17 0xffffffff83ce244d in filemon_wrapper_rename (td=0xfffff8010b855a40, uap=0xfffffe08604c7a58) at /root/ws/head/sys/modules/filemon/../../dev/filemon/filemon_wrapper.c:240 #18 0xffffffff8163f1a9 in syscallenter (td=0xfffff8010b855a40, sa=0xfffffe08604c7a48) at /root/ws/head/sys/amd64/amd64/../../kern/subr_syscall.c:135 #19 0xffffffff8163e9ea in amd64_syscall (td=0xfffff8010b855a40, traced=0) at /root/ws/head/sys/amd64/amd64/trap.c:942 Regards, Navdeep On 08/04/2016 23:23, Andriy Gapon wrote: > Author: avg > Date: Fri Aug 5 06:23:06 2016 > New Revision: 303763 > URL: https://svnweb.freebsd.org/changeset/base/303763 > > Log: > zfs: honour and make use of vfs vnode locking protocol > > ZFS POSIX Layer is originally written for Solaris VFS which is very > different from FreeBSD VFS. Most importantly many things that FreeBSD VFS > manages on behalf of all filesystems are implemented in ZPL in a different > way. > Thus, ZPL contains code that is redundant on FreeBSD or duplicates VFS > functionality or, in the worst cases, badly interacts / interferes > with VFS. > > The most prominent problem is a deadlock caused by the lock order reversal > of vnode locks that may happen with concurrent zfs_rename() and lookup(). > The deadlock is a result of zfs_rename() not observing the vnode locking > contract expected by VFS. > > This commit removes all ZPL internal locking that protects parent-child > relationships of filesystem nodes. These relationships are protected > by vnode locks and the code is changed to take advantage of that fact > and to properly interact with VFS. > > Removal of the internal locking allowed all ZPL dmu_tx_assign calls to > use TXG_WAIT mode. > > Another victim, disputable perhaps, is ZFS support for filesystems with > mixed case sensitivity. That support is not provided by the OS anyway, > so in ZFS it was a buch of dead code. > > To do: > - replace ZFS_ENTER mechanism with VFS managed / visible mechanism > - replace zfs_zget with zfs_vget[f] as much as possible > - get rid of not really useful now zfs_freebsd_* adapters > - more cleanups of unneeded / unused code > - fix / replace .zfs support > > PR: 209158 > Reported by: many > Tested by: many (thank you all!) > MFC after: 5 days > Sponsored by: HybridCluster / ClusterHQ > Differential Revision: https://reviews.freebsd.org/D6533 > > Modified: > head/sys/cddl/compat/opensolaris/sys/vnode.h > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_dir.h > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_sa.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c >