From owner-freebsd-fs@FreeBSD.ORG Fri Jul 19 18:42:47 2013 Return-Path: Delivered-To: freebsd-fs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7E326A39; Fri, 19 Jul 2013 18:42:47 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id CCCABB53; Fri, 19 Jul 2013 18:42:46 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.7/8.14.7) with ESMTP id r6JIghO5031678; Fri, 19 Jul 2013 21:42:43 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua r6JIghO5031678 Received: (from kostik@localhost) by tom.home (8.14.7/8.14.7/Submit) id r6JIghWh031677; Fri, 19 Jul 2013 21:42:43 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 19 Jul 2013 21:42:43 +0300 From: Konstantin Belousov To: Andriy Gapon Subject: Re: Deadlock in nullfs/zfs somewhere Message-ID: <20130719184243.GM5991@kib.kiev.ua> References: <51E67F54.9080800@FreeBSD.org> <51E7B686.4090509@FreeBSD.org> <20130718112814.GA5991@kib.kiev.ua> <51E7F05A.5020609@FreeBSD.org> <20130718185215.GE5991@kib.kiev.ua> <51E91277.3070309@FreeBSD.org> <20130719103025.GJ5991@kib.kiev.ua> <51E95CDD.7030702@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="GD0jJf8rm+K0B4Sk" Content-Disposition: inline In-Reply-To: <51E95CDD.7030702@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: freebsd-fs@FreeBSD.org X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jul 2013 18:42:47 -0000 --GD0jJf8rm+K0B4Sk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jul 19, 2013 at 06:35:57PM +0300, Andriy Gapon wrote: > on 19/07/2013 13:30 Konstantin Belousov said the following: > > I think that you should satisfy the VFS invariants, and prevent mutators > > from operating on the filesystem when MNTK_SUSPEND is set, for the > > case mutators are running outside the context where VFS could call > > vn_start_write() around. >=20 > I would like to inquire more about this suggestion. > > With the proposed patch zfs_suspend_fs would first call > vfs_write_suspend, which would wait for all threads that came via > VFS (and called vn_start_write) to leave and it would also mark a > filesystem as suspended and that would prevent new VFS writers. Then > zfs_suspend_fs calls zfsvfs_teardown, which would wait for all threads > in ZFS vnode ops and vfs ops to leave and would block new calls to > those ops. > > So there is a window between the filesystem being marked as > "VFS-suspended" and it becoming fully "ZFS-suspended". As I understand > you are concerned about this window. I would like to understand what > assumptions VFS code makes or could make about a filesystem marked as > suspended. I also would like to be pointed to the code that makes any > such assumptions. > > I need to understand this, because if there is any code that assumes > that a suspended filesystem is really frozen, then there can be a much > larger problem. The expectation that the suspended filesystem does not have user-visible changes (e.g. seeing changes using the syscalls) or on-disk structures changes is the guarantee of the suspend mechanism. > > Unlike UFS, ZFS does not use fs suspension for creating snapshots. It > does not need to because of its COW nature and use of transactions. > ZFS uses suspension for rollbacks, receiving of ZFS streams and fs > version upgrades. That is for operations that modify the on-disk and > in-memory data and metadata. > > So even without that window the filesystem is going to be modified. > That's the whole purpose of ZFS suspend. > Then, you cannot use VFS suspension. Or, in other words, you are directed to abuse the VFS interface. I assure you that any changes to the interface would not take into account such abuse and probably break your hack. --GD0jJf8rm+K0B4Sk Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iQIcBAEBAgAGBQJR6YiiAAoJEJDCuSvBvK1BjiYP/RaiZQSt+pHZaceUt8aUrNUl iAOoEsM+pwOzOcbHHovn4m/XnXWtC5UJDAJZH6M1HXjehOlRLx8tphJtanE9yorq Q0mMzq3SjnoMRf9ZvUzA0xDakplA/Zlk4CfxyQ/KdizCFVM6QlrfTyw/OOQijvl+ uncNQ/6t6HYxh/UVqZPkUZvOKtlH1soG7qyBV5XDi7FVGhvweJlLdJCkKlidEaZi XQMsLtoIYSCJrtldpZ/1Ah7sYUEPXOLbktTCdlhEr17YD+N0OPfrISEZO+vL4HW6 vK5yAAXiH730b+jgsAt/PuqIQCDjeIoWz/1v68deBQilZJQElV78aE4Iv8uP+w0e 5+4IPjvu1iM43sBzQG9f1gfUB3JuqgvgFQoQ1nDgXLhuops9+hAQpQC1Qv1Uzkrj dYR5aoHEVHR5WIuJfunRPwpqWKPJR0VcO8YNtBzsIdbZ9Xwl+dRbSQYbHd9vY1ng WAT/zK8PC2ntH13PQIVCHTdLU24/2gXEI6LnR8LWVm40ap0WVUn6fyDt/h55txcA KmaSFghN21/S6atZm/Gx6vf8Y/TJAuoOLTU/ikNNCw1qY+ejpR34JeSYu/700kP+ A77JnWZP9XkwA7x7Q4HQZT5GU63Zy87uK497S/d+lDKYaCLY1xmjXyHzx+h9P1lR hJ4/E5DCcV2dieownWKj =Veoy -----END PGP SIGNATURE----- --GD0jJf8rm+K0B4Sk--