From nobody Wed May 13 20:46:54 2026 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4gG59q6y8Kz6d1V4 for ; Wed, 13 May 2026 20:47:11 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4gG59q2JM3z3pG9 for ; Wed, 13 May 2026 20:47:11 +0000 (UTC) (envelope-from kostikbel@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: from tom.home (kib@localhost [127.0.0.1] (may be forged)) by kib.kiev.ua (8.18.1/8.18.1) with ESMTP id 64DKksSG049052; Wed, 13 May 2026 23:46:57 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 64DKksSG049052 Received: (from kostik@localhost) by tom.home (8.18.1/8.18.1/Submit) id 64DKks97049051; Wed, 13 May 2026 23:46:54 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 13 May 2026 23:46:54 +0300 From: Konstantin Belousov To: Shawn Webb Cc: freebsd-current@freebsd.org Subject: Re: `tail -F somefile` and ZFS weirdness Message-ID: References: List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=4.0.2 X-Spam-Checker-Version: SpamAssassin 4.0.2 (2025-08-27) on tom.home X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] X-Rspamd-Queue-Id: 4gG59q2JM3z3pG9 X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated On Wed, May 13, 2026 at 03:38:01PM +0000, Shawn Webb wrote: > Hey all, > > I just noticed this in a bhyve VM running HardenedBSD 16-CURRENT. My > `uname -a` aligns with FreeBSD commit b76b05c04cc9ed2cd053c7b367c92628447ede6f. > > (so pretend the git commit has in my `uname -a` is FreeBSD's > b76b05c04cc9ed2cd053c7b367c92628447ede6f commit.) > > I don't recall seeing this message before, so I suspect it might have > been introduced relatively recently. > > ==== BEGIN LOG ==== > $ uname -a > FreeBSD hbsd-current-02 16.0-CURRENT FreeBSD 16.0-CURRENT #5 hardened/current/master-n196117-464cdf02df98-dirty: Wed May 13 01:12:14 UTC 2026 shawn@hbsd-current-02:/usr/obj/usr/src/amd64.amd64/sys/HARDENEDBSD amd64 > > $ tail -n 21 /var/log/messages > rms_rlock with the following non-sleepable locks held: > exclusive sleep mutex kqueue (kqueue) r = 0 (0xfffff80001d0b400) locked @ /usr/src/sys/kern/kern_event.c:2586 > stack backtrace: > #0 0xffffffff80c921dc at witness_debugger+0x6c > #1 0xffffffff80c93adc at witness_warn+0x4bc > #2 0xffffffff80c0e10f at rms_rlock+0x1f > #3 0xffffffff82799a6b at zfs_freebsd_getattr+0x11b > #4 0xffffffff8127dba7 at VOP_GETATTR_APV+0x57 > #5 0xffffffff80d2a7db at vn_getsize_locked+0x7b > #6 0xffffffff80d30b6d at filt_vfsread+0x8d > #7 0xffffffff80bb4d06 at knote+0xd6 > #8 0xffffffff80d28a48 at vop_read_post+0x48 > #9 0xffffffff8127e07a at VOP_READ_APV+0x9a > #10 0xffffffff80d450f2 at vn_read+0x242 > #11 0xffffffff80d44df5 at vn_io_fault_doio+0x55 > #12 0xffffffff80d3ff2f at vn_io_fault1+0x19f > #13 0xffffffff80d3d040 at vn_io_fault+0x190 > #14 0xffffffff80c97e95 at dofileread+0x85 > #15 0xffffffff80c97852 at sys_read+0x132 > #16 0xffffffff811a7974 at amd64_syscall+0x184 > #17 0xffffffff81175f0b at fast_syscall_common+0xf8 > ==== END LOG ==== > > Thanks, > > -- > Shawn Webb > Cofounder / Security Engineer > HardenedBSD > > Signal Username: shawn_webb.74 > Tor-ified Signal: +1 303-901-1600 / shawn_webb_opsec.50 > https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc Try this, untested. I should have not changed this, but then I do not understand why it only appeared now. commit c3a20bdb7caa3628831bf443cfb1e0316e30d3e7 Author: Konstantin Belousov Date: Wed May 13 23:44:45 2026 +0300 vop_read{,_pgcache}_post(): unlock knote around call into filter ZFS vop_getattr() needs a sleepable lock. diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index b3a6e8ce2e02..d19776940bc3 100644 --- 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); INOTIFY(a->a_vp, IN_ACCESS); } } @@ -6520,7 +6520,7 @@ vop_read_pgcache_post(void *ap, int rc) struct vop_read_pgcache_args *a = ap; if (rc == 0) { - VFS_KNOTE_LOCKED(a->a_vp, NOTE_READ); + VN_KNOTE_UNLOCKED(a->a_vp, NOTE_READ); INOTIFY(a->a_vp, IN_ACCESS); } }