Deadlock in nullfs/zfs somewhere
Andriy Gapon
avg at FreeBSD.org
Thu Jul 18 13:41:50 UTC 2013
on 18/07/2013 14:28 Konstantin Belousov said the following:
> Well, I have no opinion. Making the fs suspended, in other words, preventing
> writers from entering the filesystem code, is probably good. I do not
> know zfs code to usefully comment on the approach.
OK, fair.
> Note that you must drain existing writers, i.e. call vfs_write_suspend(),
> to set MNTK_SUSPEND.
Here is my take on it, not tested at all.
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
index 0fc59cc..59c8cbd 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
@@ -2263,8 +2263,12 @@ zfs_suspend_fs(zfsvfs_t *zfsvfs)
{
int error;
- if ((error = zfsvfs_teardown(zfsvfs, B_FALSE)) != 0)
+ if ((error = vfs_write_suspend(zfsvfs->z_vfs)) != 0)
return (error);
+ if ((error = zfsvfs_teardown(zfsvfs, B_FALSE)) != 0) {
+ vfs_write_resume(mp, 0);
+ return (error);
+ }
dmu_objset_disown(zfsvfs->z_os, zfsvfs);
return (0);
@@ -2339,5 +2343,6 @@ bail:
rrw_exit(&zfsvfs->z_teardown_lock, FTAG);
+ vfs_write_resume(mp, 0);
if (err) {
/*
* Since we couldn't reopen zfsvfs::z_os, or
--
Andriy Gapon
More information about the freebsd-fs
mailing list