Deadlock in nullfs/zfs somewhere

Konstantin Belousov kostikbel at gmail.com
Fri Jul 19 18:42:47 UTC 2013


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.
> 
> 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20130719/fa22245d/attachment.sig>


More information about the freebsd-fs mailing list