Bump the vnode use count, not just its hold count. This fixes a panic
triggered by fstatat(..., AT_EMPTY_PATH) on DRM device nodes, which happens
to be what glxinfo(1) from Ubuntu Jammy is doing.
PR: kern/274538
Differential D47391
Fix "vrefact: wrong use count 0" with DRM Authored by trasz on Nov 1 2024, 3:12 PM. Tags None Referenced Files
Details Bump the vnode use count, not just its hold count. This fixes a panic PR: kern/274538
Diff Detail
Event TimelineComment Actions This follows a somewhat similar fix in https://reviews.freebsd.org/D29323?id=86801. I can't say I have a proper understanding of what's going on here though. Here's the test case from Alex S: #define _GNU_SOURCE
#include <assert.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/stat.h>
int main() {
int fd = open("/dev/dri/card0", O_RDWR);
assert(fd != -1);
struct stat st;
fstatat(fd, "", &st, AT_EMPTY_PATH);
return 0;
}Comment Actions This cannot be right. If the file references vnode, vnode must be active and have the use count at least 1, because file vref-ed the vnode on open. Comment Actions Good point. Okay, so here's another attempt; this time in code specific to linuxkpi. Comment Actions If going that way, then you can remove the adjacent vhold() and vdrop() as they are redundant. Comment Actions Get rid of vhold/vdrop. I've been running it for a few days |