Re: git: f1f230439fa4 - main - vfs: Initial revision of inotify

From: Olivier Certner <olce_at_freebsd.org>
Date: Sun, 13 Jul 2025 13:46:57 UTC
Hi Charlie,

The panic you're seeing is caused by 'MPASS(*eofflag != 0);' in vn_dir_next_dirent().  This test is here to check that VOP_READDIR() works properly.  In particular, if VOP_READDIR() returned 0 (no error), and the length it filled is 0 (nothing was added), then we must be at EOF, and VOP_READDIR() must have set '*eofflag' to something non-zero.  UFS has been verified to abide by this rule (unless the directory being read is malformed).  Which filesystem are you using?

Shot in the dark & educated guess: You're using ZFS, and you've just stumbled on the following case (lines from 'zfs_vnops_os.c'):

        /*                                                                                                                                                
         * Quit if directory has been removed (posix)                                                                                                     
         */
        if ((*eofp = zp->z_unlinked) != 0) {
                zfs_exit(zfsvfs, FTAG);
                return (0);
        }

which is a corner case that apparently has been missed.  Just add some 'if (eofflag != NULL) *eofflag = 1;' inside the "then" block there and retry.  It looks like all other cases in this function are handled correctly (but I have not thoroughly verified).

I'll be mostly AFK for the next 10 days, so probably won't be able to follow-up, but hope that will help.

Thanks and regards.

-- 
Olivier Certner