Re: rms_rlock with non-sleepable locks held
Date: Sat, 16 May 2026 19:14:37 UTC
On Sat, May 16, 2026 at 04:13:06PM +0200, Dag-Erling Smørgrav wrote:
> Dag-Erling Smørgrav <des@FreeBSD.org> writes:
> > Konstantin Belousov <kostikbel@gmail.com> writes:
> > > --- a/sys/kern/vfs_subr.c
> > > +++ b/sys/kern/vfs_subr.c
> > > @@ -6509,7 +6509,7 @@ vop_read_post(void *ap, int rc)
> > > struct vop_read_args *a = ap;
> > >
> > > if (!rc) {
> > > - VFS_KNOTE_LOCKED(a->a_vp, NOTE_READ);
> > > + VN_KNOTE_LOCKED(a->a_vp, NOTE_READ);
> > Did you mean to use VN_KNOTE_UNLOCKED() here...
>
> Probably not, as that resulted in a panic...
Try this instead
commit 4ef4999153389a423954fbf4c3d2e679fb96e110
Author: Konstantin Belousov <kib@FreeBSD.org>
Date: Sat May 16 22:11:43 2026 +0300
sys/mount.h: restore KNF_NOKQLOCK in VFS_KNOTE_{,UN}LOCKED
ZFS needs to take internal sleepable lock in its implementation of
VOP_GETATTR(). Due to this, kq must be unlocked around calls to the vfs
filter methods.
Fixes: 1d5e4020e36e1cc9e906200c9c3c784ef43d977e
diff --git a/sys/sys/mount.h b/sys/sys/mount.h
index d6696bba0a4f..2e880bac9068 100644
--- a/sys/sys/mount.h
+++ b/sys/sys/mount.h
@@ -968,8 +968,8 @@ static inline void
VFS_KNOTE_LOCKED(struct vnode *vp, int hint)
{
if ((vn_irflag_read(vp) & VIRF_KNOTE) != 0) {
- KNOTE_LOCKED(&vp->v_pollinfo->vpi_selinfo.si_note,
- hint);
+ KNOTE(&vp->v_pollinfo->vpi_selinfo.si_note,
+ hint, KNF_LISTLOCKED | KNF_NOKQLOCK);
}
}
@@ -977,8 +977,8 @@ static inline void
VFS_KNOTE_UNLOCKED(struct vnode *vp, int hint)
{
if ((vn_irflag_read(vp) & VIRF_KNOTE) != 0) {
- KNOTE_UNLOCKED(&vp->v_pollinfo->vpi_selinfo.si_note,
- hint);
+ KNOTE(&vp->v_pollinfo->vpi_selinfo.si_note,
+ hint, KNF_NOKQLOCK);
}
}