Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Jul 2013 21:42:43 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Andriy Gapon <avg@FreeBSD.org>
Cc:        freebsd-fs@FreeBSD.org
Subject:   Re: Deadlock in nullfs/zfs somewhere
Message-ID:  <20130719184243.GM5991@kib.kiev.ua>
In-Reply-To: <51E95CDD.7030702@FreeBSD.org>
References:  <CAJ-VmokR8jJpdRc_kBJzhW4_R1pJnj3UPfsG5ANpq-kEGwCP9g@mail.gmail.com> <51E67F54.9080800@FreeBSD.org> <CAJ-Vmonk2HAzX38-mbL8hwxiUfL6JyJrMTq0dTBctW=P4dfyEQ@mail.gmail.com> <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>

next in thread | previous in thread | raw e-mail | index | archive | help

--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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130719184243.GM5991>