Bug 240221 - sys.cddl.zfs.tests.atime.atime_test.atime_001_pos panics kernel
Summary: sys.cddl.zfs.tests.atime.atime_test.atime_001_pos panics kernel
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: tests (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Mateusz Guzik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-30 20:12 UTC by Li-Wen Hsu
Modified: 2019-08-31 13:25 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Li-Wen Hsu freebsd_committer freebsd_triage 2019-08-30 20:12:20 UTC
Starting from this build: https://ci.freebsd.org/job/FreeBSD-head-amd64-test_zfs/3479/

The revisions included in this build are r351584 (looks most likely), r351585, r351587

Panic message:

tests/atime/atime_test:atime_001_pos  ->  VNASSERT failed
0xfffff800802ac1e0: tag zfs, type VDIR
    usecount 0, writecount 0, refcount 1 mountedhere 0
    flags (VI_ACTIVE)
 VI_LOCKed    lock type zfs: UNLOCKED
        name = testsnap1211
        parent_id = 2
        id = 85
panic: No vop_need_inactive(0xfffff800802ac1e0, 0xfffffe004fca14d0)
cpuid = 1
time = 1567118769
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe004fca13f0
vpanic() at vpanic+0x19d/frame 0xfffffe004fca1440
panic() at panic+0x43/frame 0xfffffe004fca14a0
VOP_NEED_INACTIVE_APV() at VOP_NEED_INACTIVE_APV+0xf4/frame 0xfffffe004fca14c0
vputx() at vputx+0x1b0/frame 0xfffffe004fca1520
vfs_mount_destroy() at vfs_mount_destroy+0x14f/frame 0xfffffe004fca1550
dounmount() at dounmount+0x7eb/frame 0xfffffe004fca15b0
zfs_unmount_snap() at zfs_unmount_snap+0xbb/frame 0xfffffe004fca15d0
zfs_ioc_destroy_snaps() at zfs_ioc_destroy_snaps+0xda/frame 0xfffffe004fca1620
zfsdev_ioctl() at zfsdev_ioctl+0x783/frame 0xfffffe004fca16b0
devfs_ioctl() at devfs_ioctl+0xca/frame 0xfffffe004fca1700
VOP_IOCTL_APV() at VOP_IOCTL_APV+0x63/frame 0xfffffe004fca1720
vn_ioctl() at vn_ioctl+0x13d/frame 0xfffffe004fca1830
devfs_ioctl_f() at devfs_ioctl_f+0x1f/frame 0xfffffe004fca1850
kern_ioctl() at kern_ioctl+0x295/frame 0xfffffe004fca18b0
sys_ioctl() at sys_ioctl+0x15d/frame 0xfffffe004fca1980
amd64_syscall() at amd64_syscall+0x2b9/frame 0xfffffe004fca1ab0
fast_syscall_common() at fast_syscall_common+0x101/frame 0xfffffe004fca1ab0
--- syscall (54, FreeBSD ELF64, sys_ioctl), rip = 0x8004b62ea, rsp = 0x7fffffffafa8, rbp = 0x7fffffffb020 ---


Full log is available at: https://ci.freebsd.org/job/FreeBSD-head-amd64-test_zfs/3479/consoleFull

To reproduce:

```
mdconfig -t malloc -s 128m

cat <<EOF >> /usr/local/etc/kyua/kyua.conf
test_suites.FreeBSD.disks = '/dev/md0'
EOF

cd /usr/tests/sys/cddl/zfs/tests/atime

kyua debug atime_test:atime_001_pos
```
Comment 1 Li-Wen Hsu freebsd_committer freebsd_triage 2019-08-30 20:14:27 UTC
The VM image running that test is available at https://artifact.ci.freebsd.org/snapshot/head/r351587/amd64/amd64/disk-test.img.xz
Comment 2 Li-Wen Hsu freebsd_committer freebsd_triage 2019-08-30 20:16:15 UTC
mjg: can you help check this?
Comment 3 Mateusz Guzik freebsd_committer freebsd_triage 2019-08-30 20:59:46 UTC
The reproduce fails for me with a weird error.

This should do the trick though:
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
index a039de39866..c95466a55cc 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
@@ -1247,6 +1247,7 @@ zfsctl_snapshot_vptocnp(struct vop_vptocnp_args *ap)
 static struct vop_vector zfsctl_ops_snapshot = {
        .vop_default =          NULL, /* ensure very restricted access */
        .vop_inactive =         zfsctl_snapshot_inactive,
+       .vop_inactive =         vop_stdneed_inactive,
        .vop_reclaim =          zfsctl_snapshot_reclaim,
        .vop_vptocnp =          zfsctl_snapshot_vptocnp,
Comment 4 Mateusz Guzik freebsd_committer freebsd_triage 2019-08-30 21:00:39 UTC
Oops, meant this:

diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
index a039de39866..551c89045cb 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
@@ -1247,6 +1247,7 @@ zfsctl_snapshot_vptocnp(struct vop_vptocnp_args *ap)
 static struct vop_vector zfsctl_ops_snapshot = {
        .vop_default =          NULL, /* ensure very restricted access */
        .vop_inactive =         zfsctl_snapshot_inactive,
+       .vop_need_inactive =    vop_stdneed_inactive,
        .vop_reclaim =          zfsctl_snapshot_reclaim,
        .vop_vptocnp =          zfsctl_snapshot_vptocnp,
        .vop_lock1 =            vop_stdlock,
Comment 5 commit-hook freebsd_committer freebsd_triage 2019-08-31 13:24:35 UTC
A commit references this bug:

Author: mjg
Date: Sat Aug 31 13:24:22 UTC 2019
New revision: 351642
URL: https://svnweb.freebsd.org/changeset/base/351642

Log:
  zfs: fix snapshot dir destruction after introducion of VOP_NEED_INACTIVE

  Reported by:	lwhsu
  PR:		240221
  Sponsored by:	The FreeBSD Foundation

Changes:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
Comment 6 Mateusz Guzik freebsd_committer freebsd_triage 2019-08-31 13:25:03 UTC
reproduced by manually exporting a pool with snapshots