From fe628bc21d360336307d1da09bc9260a46dde444 Mon Sep 17 00:00:00 2001 From: Matthew Macy Date: Sat, 1 Aug 2020 08:42:55 -0700 Subject: [PATCH] Fix page fault in zfsctl_snapdir_getattr Must acquire the z_teardown_lock before accessing the zfsvfs_t object. I can't reproduce this panic on demand, but this looks like the correct solution. Reviewed-by: Ryan Moeller Reviewed-by: Brian Behlendorf Authored-by: asomers Signed-off-by: Matt Macy Closes #10656 --- module/os/freebsd/zfs/zfs_ctldir.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/module/os/freebsd/zfs/zfs_ctldir.c b/module/os/freebsd/zfs/zfs_ctldir.c index 8481a9d751..0fe32b1952 100644 --- a/module/os/freebsd/zfs/zfs_ctldir.c +++ b/module/os/freebsd/zfs/zfs_ctldir.c @@ -1088,11 +1088,12 @@ zfsctl_snapdir_getattr(struct vop_getattr_args *ap) vnode_t *vp = ap->a_vp; vattr_t *vap = ap->a_vap; zfsvfs_t *zfsvfs = vp->v_vfsp->vfs_data; - dsl_dataset_t *ds = dmu_objset_ds(zfsvfs->z_os); + dsl_dataset_t *ds; uint64_t snap_count; int err; ZFS_ENTER(zfsvfs); + ds = dmu_objset_ds(zfsvfs->z_os); zfsctl_common_getattr(vp, vap); vap->va_ctime = dmu_objset_snap_cmtime(zfsvfs->z_os); vap->va_mtime = vap->va_ctime;