From owner-svn-src-head@freebsd.org Thu Jul 30 07:24:05 2015 Return-Path: Delivered-To: svn-src-head@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 271529AEDE5; Thu, 30 Jul 2015 07:24:05 +0000 (UTC) (envelope-from kmacybsd@gmail.com) Received: from mail-pa0-x234.google.com (mail-pa0-x234.google.com [IPv6:2607:f8b0:400e:c03::234]) (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 EAEBD843; Thu, 30 Jul 2015 07:24:04 +0000 (UTC) (envelope-from kmacybsd@gmail.com) Received: by padck2 with SMTP id ck2so19069577pad.0; Thu, 30 Jul 2015 00:24:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=lEBEly6YSrHJGEAEFdMLa4MoX8SwycGo/s50zxCmL3g=; b=JdLoL0zK6PdSoxPp14+aHcwwBRrNiasHgw7XMsCD8CHhd4CNwhhbBfDa8N53GnH0Bc FRcpnh6dSClpBg6XX8vxc0XItteMX4XdKrfMwanOqDSmVylkDbmzaHfbUZlycD78ovx4 KHW+LtLeVI/1szaKlKMxZKr9RZ7UoVok4RWrXEItnv6m+szFQdiBGuLu0tkTAhrkruUx 47mEM+uyljruySJ5Cl13evo/BLwAI6fDIlqg6wFxqMg4K0HzOwNJwcGES0cwRwrGLHR1 BYUw0vpRhCnwjMrOI/tD6AYz5n8pwEjMNIUjTML7ig7rKdsXAQ8809vfd4PzRu1TchHs J4tQ== MIME-Version: 1.0 X-Received: by 10.66.55.66 with SMTP id q2mr102678590pap.94.1438241044390; Thu, 30 Jul 2015 00:24:04 -0700 (PDT) Sender: kmacybsd@gmail.com Received: by 10.66.236.36 with HTTP; Thu, 30 Jul 2015 00:24:04 -0700 (PDT) In-Reply-To: <201507020832.t628W3WJ002944@repo.freebsd.org> References: <201507020832.t628W3WJ002944@repo.freebsd.org> Date: Thu, 30 Jul 2015 00:24:04 -0700 X-Google-Sender-Auth: xwVfBLks0DdEYtwYFWxf0Kgm_zE Message-ID: Subject: Re: svn commit: r285021 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs From: "K. Macy" To: Andriy Gapon Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" , Xin Li Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 07:24:05 -0000 Just FYI this change introduces a deadlock with with the spa_namespace_lock. Mount will be holding this lock while trying to acquire the spa_namespace_lock. zfskern on the other hand holds the spa_namespace_lock when calling zfs_freebsd_access which in turn tries to acquire the teardown lock. static int zfs_access(vnode_t *vp, int mode, int flag, cred_t *cr, caller_context_t *ct) { znode_t *zp = VTOZ(vp); zfsvfs_t *zfsvfs = zp->z_zfsvfs; int error; ZFS_ENTER(zfsvfs); where: /* Called on entry to each ZFS vnode and vfs operation */ #define ZFS_ENTER(zfsvfs) \ { \ rrm_enter_read(&(zfsvfs)->z_teardown_lock, FTAG); \ if ((zfsvfs)->z_unmounted) { \ ZFS_EXIT(zfsvfs); \ return (EIO); \ } \ I think this makes a pretty strong case for the need to educate WITNESS about rrm locks. Cheers. -K On Thu, Jul 2, 2015 at 1:32 AM, Andriy Gapon wrote: > Author: avg > Date: Thu Jul 2 08:32:02 2015 > New Revision: 285021 > URL: https://svnweb.freebsd.org/changeset/base/285021 > > Log: > zfs_mount(MS_REMOUNT): protect zfs_(un)register_callbacks calls > > We now take z_teardown_lock as a writer to ensure that there is no I/O > while the filesystem state is in a flux. Also, zfs_suspend_fs() -> > zfsvfs_teardown() call zfs_unregister_callbacks() and zfs_resume_fs() -> > zfsvfs_setup() call zfs_unregister_callbacks(). Previously there was no > synchronization between those calls and the calls in the re-mounting > case. That could lead to concurrent execution and a crash. > > PR: 180060 > Differential Revision: https://reviews.freebsd.org/D2865 > Suggested by: mahrens > Reviewed by: delphij, pho, mahrens, will > MFC after: 13 days > Sponsored by: ClusterHQ > > Modified: > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Thu Jul 2 08:25:45 2015 (r285020) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Thu Jul 2 08:32:02 2015 (r285021) > @@ -1717,9 +1717,19 @@ zfs_mount(vfs_t *vfsp) > * according to those options set in the current VFS options. > */ > if (vfsp->vfs_flag & MS_REMOUNT) { > - /* refresh mount options */ > - zfs_unregister_callbacks(vfsp->vfs_data); > + zfsvfs_t *zfsvfs = vfsp->vfs_data; > + > + /* > + * Refresh mount options with z_teardown_lock blocking I/O while > + * the filesystem is in an inconsistent state. > + * The lock also serializes this code with filesystem > + * manipulations between entry to zfs_suspend_fs() and return > + * from zfs_resume_fs(). > + */ > + rrm_enter(&zfsvfs->z_teardown_lock, RW_WRITER, FTAG); > + zfs_unregister_callbacks(zfsvfs); > error = zfs_register_callbacks(vfsp); > + rrm_exit(&zfsvfs->z_teardown_lock, FTAG); > goto out; > } > > _______________________________________________ > svn-src-head@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org"