From nobody Fri Aug 15 22:51:53 2025 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 4c3cn22TfQz64QZY for ; Fri, 15 Aug 2025 22:52:06 +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 4c3cn16F0wz3sTW for ; Fri, 15 Aug 2025 22:52:05 +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 57FMpr9H038443; Sat, 16 Aug 2025 01:51:56 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 57FMpr9H038443 Received: (from kostik@localhost) by tom.home (8.18.1/8.18.1/Submit) id 57FMprEi038442; Sat, 16 Aug 2025 01:51:53 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 16 Aug 2025 01:51:53 +0300 From: Konstantin Belousov To: Bakul Shah Cc: FreeBSD Current Subject: Re: zfs related panic Message-ID: References: <14C5523D-1F66-434F-A4D9-E14DA4BBF1E9@iitbombay.org> 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 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <14C5523D-1F66-434F-A4D9-E14DA4BBF1E9@iitbombay.org> 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.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on tom.home X-Spamd-Bar: ---- 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-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Queue-Id: 4c3cn16F0wz3sTW On Fri, Aug 15, 2025 at 11:19:55AM -0700, Bakul Shah wrote: > Is this a known bug or may be something specific on my machine? > If the latter, any way to "fsck" it? FYI, the zpool is a mirror > (two files on the host via nvme). built from c992ac621327 commit hash > (which has other issues but they seem to be separate from this). > I saw the same panic when I booted from a day old snapshot. > > Note that "ls /.zfs" panics but "ls /.zfs/snapshot" doesn't! > > This is on a -current VM: > > root@:/ # ls .zfs > VNASSERT failed: oresid == 0 || nresid != oresid || *(a)->a_eofflag == 1 not true at vnode_if.c:1824 (VOP_READDIR_APV) Try this, untested. commit a97fc29bf2c03bbfc57b9c188ab3b24450d453bc Author: Konstantin Belousov Date: Sat Aug 16 01:50:42 2025 +0300 zfs control dir: properly set eof diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ctldir.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ctldir.c index 61d0bb26d1e5..725c02d47edf 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ctldir.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ctldir.c @@ -1056,17 +1056,22 @@ zfsctl_snapdir_readdir(struct vop_readdir_args *ap) zfs_uio_t uio; int *eofp = ap->a_eofflag; off_t dots_offset; + offset_t orig_resid; int error; zfs_uio_init(&uio, ap->a_uio); + orig_resid = uio.uio->uio_resid; ASSERT3S(vp->v_type, ==, VDIR); error = sfs_readdir_common(ZFSCTL_INO_ROOT, ZFSCTL_INO_SNAPDIR, ap, &uio, &dots_offset); if (error != 0) { - if (error == ENAMETOOLONG) /* ran out of destination space */ + if (error == ENAMETOOLONG) { /* ran out of destination space */ error = 0; + if (orig_resid == uio.uio->uio_resid && eofp != NULL) + *eofp = 1; + } return (error); } @@ -1084,7 +1089,8 @@ zfsctl_snapdir_readdir(struct vop_readdir_args *ap) dsl_pool_config_exit(dmu_objset_pool(zfsvfs->z_os), FTAG); if (error != 0) { if (error == ENOENT) { - if (eofp != NULL) + if (orig_resid == uio.uio->uio_resid && + eofp != NULL) *eofp = 1; error = 0; } @@ -1099,8 +1105,12 @@ zfsctl_snapdir_readdir(struct vop_readdir_args *ap) entry.d_reclen = sizeof (entry); error = vfs_read_dirent(ap, &entry, zfs_uio_offset(&uio)); if (error != 0) { - if (error == ENAMETOOLONG) + if (error == ENAMETOOLONG) { error = 0; + if (orig_resid == uio.uio->uio_resid && + eofp != NULL) + *eofp = 1; + } zfs_exit(zfsvfs, FTAG); return (SET_ERROR(error)); }