NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/57018: Missing VOP_BMAP() implementation for block devices on ZFS



>Number:         57018
>Category:       kern
>Synopsis:       Missing VOP_BMAP() implementation for block devices on ZFS
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Sep 22 22:30:00 +0000 2022
>Originator:     Molly Miller
>Release:        9.3_STABLE
>Organization:
>Environment:
NetBSD pentagram.sqrt-minus.one 9.3_STABLE NetBSD 9.3_STABLE (GENERIC) #17: Thu Sep 22 22:39:18 CEST  molly%pentagram.sqrt-minus.one@localhost:/src/obj/stable-9/sys/arch/amd64/compile/GENERIC amd64
>Description:
The vnodeops(9) for block devices on ZFS is missing an implementation of VOP_BMAP() on NetBSD 9.3.

The vnode operations for special devices on ZFS are declared at external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:6356, and attached to block device vnodes at external/cddl/osnet/dist/uts/common/fs/zfs/zfs_znode.c:714. When the ZFS module is loaded and the filesystem is attached with vfs_attach(9), the vnode ops vectors are allocated and populated; as there is no VOP_BMAP() implementation provided, a default handler is used instead, which happens to return EOPNOTSUPP when invoked.

I discovered this via the circuitous route of mount_ffs(8) being unable to mount my laptop's FFS bootstrap partition when I passed the "-o log" options, reporting "Operation not supported". I eventually determined that passing "-o log" adds MNT_LOG to the mount flags, which causes the FFS driver to invoke wapbl(4) for journaling, and wapbl(4) calls VOP_BMAP() on the source device's vnode. My root filesystem (and /dev) is on ZFS, which means that the ZFS handler gets called, as described above, causing the mount to fail. (If I omit "-o log" then wapbl(4) is never called, and the mount completes successfully.)
>How-To-Repeat:
Attempt to mount a FFS filesystem with the journaling flag enabled, where the source device node for the mount resides on a ZFS volume.
>Fix:
sys/miscfs/specfs exists to provide vnodeops(9) implementations for block and character devices, and other filesystems (at least FFS) use the specfs implementation of VOP_BMAP() (which is a nop). Adding a corresponding entry to the ZFS vnode ops vector for special devices (containing {&vop_desc_bmap, spec_bmap}) fixes this issue.

This has been fixed in -current with r1.72 of zfs_vnops.c, which might be a candidate for backporting to netbsd-9.



Home | Main Index | Thread Index | Old Index