Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/cddl/osnet/dist/uts/common/fs/zfs Add native vfs_su...
details: https://anonhg.NetBSD.org/src/rev/3f1de3614526
branches: trunk
changeset: 452056:3f1de3614526
user: hannken <hannken%NetBSD.org@localhost>
date: Mon Jun 17 08:09:57 2019 +0000
description:
Add native vfs_suspend()/vfs_resume() before and after
zfs_suspend_fs()/zfs_resume_fs() and get rid of dead "z_sa_hdl == NULL"
znodes before vfs_resume() to keep the vnode cache consistent.
Live rollback should work now.
PR port-xen/54273 ("zpool create pool xbd2" panics DOMU kernel)
diffstat:
external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c | 32 +++++++++++++++++
1 files changed, 32 insertions(+), 0 deletions(-)
diffs (65 lines):
diff -r 1c29368e93b7 -r 3f1de3614526 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c Mon Jun 17 08:08:50 2019 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c Mon Jun 17 08:09:57 2019 +0000
@@ -121,6 +121,7 @@
#ifdef __NetBSD__
+#include <sys/fstrans.h>
#include <sys/mkdev.h>
#include <miscfs/genfs/genfs.h>
@@ -2669,8 +2670,17 @@
{
int error;
+#ifdef __NetBSD__
+ if ((error = vfs_suspend(zfsvfs->z_vfs, 0)) != 0)
+ return error;
+ if ((error = zfsvfs_teardown(zfsvfs, B_FALSE)) != 0) {
+ vfs_resume(zfsvfs->z_vfs);
+ return (error);
+ }
+#else
if ((error = zfsvfs_teardown(zfsvfs, B_FALSE)) != 0)
return (error);
+#endif
return (0);
}
@@ -2682,6 +2692,16 @@
* are the same: the relevant objset and associated dataset are owned by
* zfsvfs, held, and long held on entry.
*/
+#ifdef __NetBSD__
+static bool
+zfs_resume_selector(void *cl, struct vnode *vp)
+{
+
+ if (zfsctl_is_node(vp))
+ return false;
+ return (VTOZ(vp)->z_sa_hdl == NULL);
+}
+#endif
int
zfs_resume_fs(zfsvfs_t *zfsvfs, dsl_dataset_t *ds)
{
@@ -2725,6 +2745,18 @@
/* release the VOPs */
rw_exit(&zfsvfs->z_teardown_inactive_lock);
rrm_exit(&zfsvfs->z_teardown_lock, FTAG);
+#ifdef __NetBSD__
+ struct vnode_iterator *marker;
+ vnode_t *vp;
+
+ vfs_vnode_iterator_init(zfsvfs->z_vfs, &marker);
+ while ((vp = vfs_vnode_iterator_next(marker,
+ zfs_resume_selector, NULL))) {
+ vgone(vp);
+ }
+ vfs_vnode_iterator_destroy(marker);
+ vfs_resume(zfsvfs->z_vfs);
+#endif
if (err) {
/*
Home |
Main Index |
Thread Index |
Old Index