Date: Fri, 19 Jul 2013 18:35:57 +0300 From: Andriy Gapon <avg@FreeBSD.org> To: Konstantin Belousov <kostikbel@gmail.com> Cc: freebsd-fs@FreeBSD.org Subject: Re: Deadlock in nullfs/zfs somewhere Message-ID: <51E95CDD.7030702@FreeBSD.org> In-Reply-To: <20130719103025.GJ5991@kib.kiev.ua> References: <CAJ-VmokctCmV4%2By17uvqO9wXEyh0s%2BaXZ9nggvoAgP5%2BZHSgFA@mail.gmail.com> <51E59FD9.4020103@FreeBSD.org> <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>
next in thread | previous in thread | raw e-mail | index | archive | help
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. 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. -- Andriy Gapon
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?51E95CDD.7030702>